Hey buddies, welcome to my very first post on VB.Net. As per many requests from the user, I’m going to start the new tutorial series on VB.Net. To create any project on visual basic we will require an IDE (Integrated Development Environment). Just like other programming languages such as C, C++, we need to install the appropriate compiler to execute the programs. For example, to compile and execute an application in Java we need the JDK. At the very first post in Java swing, we have already seen the installation of JDK. This is our first post, so we will learn how to download and install the Visual Studio. Visual Studio is available for Windows and other platforms. The Microsoft provides the Visual Studio IDE for the developer.
The developer uses it to create Windows application, Console based application, Web-based application, Web services as well as the Mobile application for the smartphones.
Visual Studio For Windows and Other Platforms
- Visual Studio is freemium professional developers tools that provide the standard features and platforms to create visual basic applications.
- I’m not going to discuss more the features of VS. For more details, you can see the Features here.
- You can download it from the official download page of the Microsoft.
- When you will go to the download page you will see the different edition of the VS.
- See below, the download page is given here.
- Choose the VS Professional version of the download.
- The latest version is 2017. You can download the VS trial version free for 90 days only.
- After then it will require the license key.
Installation of Visual Studio
- Once the download is finished, just install it as the normal installation.
- During installation, it will download the necessary packages and libraries at the runtime. So you will require the internet connection.
- The earlier versions of VS were installing in offline mode.
How to Start with Visual Studio
- After successful installation of VS now its time to make it in use for the first time.
- So launch the VS, it will show you the window for the account sign in.
- Sign in with the appropriate account details or you may do it later.
- The next window will appear to choose the Development Setting and the color theme.
- Select the development environment from the given list. Here we are going to create and learn the Visual Basic application. So select the Visual Basic from the option.
- In the next step, you will require selecting the color theme for the development environment. You can select any color theme from the given option.
- After selecting, just click on Start Visual Studio button.
- It will take few minutes for configuration of first use. So just wait for the completion.
Creating First Visual Studio Project
- So let’s create the first project in Visual Studio.
- To start the first project just click on the New Project from the Start option.
- In another way you can go to the File -> New -> Project
- The following window will appear you.
Step 1: Select the language from the left side option that is shown in the image.
- I have selected Visual Basic in the Templates.
Step 2: Choose the .NET Framework for your project.
- The .NET Framework provides the large set of class libraries, GUI components, and the other necessary packages to create and run the application.
- It provides a platform on which the Visual Basic application runs.
Step 3: Select the Type of Application
- After selecting the .NET Framework, choose the type of application that you want to create.
- Here I’m going to create a Console Application in which I’ll show some message.
- So select the option and move to the next step.
Step 4: Give the Name of the Project
- Give the project name. In my case it is FirstConsoleApp.
- Now choose the project location. The Visual Studio will contain the default directory to save the projects. You can change the project directory as per your requirement.
- But in this case, I recommend you to leave it as default.
Step 5: Click OK Button
- After completing these steps, just click on the OK button. The project will be loading and it will take few seconds.
- After finishing the project setup, you will be redirected to the code editor of the project.
- Now its time to write some code here.
Visual Basic Program For Hello Message
- The code editor will show you to write the program codes.
- See the demo in the below image.
- Take a look at the source code here.
- In the above program Module is a predefined keyword which contains the packages, classes, interfaces and the other libraries. It is the way to include it in our program.
- Sub Main() – This is the main method in Visual Basic from where the program execution begins.
- Console.Write() – This is a method which is used to print any statement on the console. We can also use Console.WriteLine() – The method prints the statement and breaks the line. It moves the cursor to the next line. This is similar to the ” \n ” in C and C++.
Visual Basic is case insensitive language that means the upper case or lower case formatting doesn’t matter when you write the prgoram code.
Every opening of methods, function, procedures will be closed automatically. You no need to close it separtely like C, C++ or Java programming language.
It doesn’t require any end of statement termination like semicolon (;)
Visual Basic doesn’t support parantheses for opening of any methods or functions.
How to Run the Visual Basic Project
- Before going to run the project save the project files.
- To run the project there is a Start button on the menu bar option. Just click on that, your project will start the debugging.
- In another way, you can go to the Debug menu and click on the Start Debugging option. Or you can press F5 from the keyboard to use the shortcut.
- Once your project debugging is completed, you will see the console is not showing there.
- Actually, your project debugging has succeeded but the console screen is not holding up to show the result.
- So for this, we will use a method that is Console.ReadLine().
- Console.ReadLine() – This method is used to hold the console screen so that the output can display on the screen. This is same as getch() in C and C++.
- Save and debug your project again and you will see the result as the output is displaying to the console.
- In another way, you can use Debug.WriteLine() to print the statement instead of Console.WriteLine().
- The difference is that the Console.WriteLine() method prints the statement to the console screen. But the Debug.WriteLine() will print the statement in the Visual Studio to the Output Window.
- See the result below.
- This is similar to the Eclipse IDE in which the result displays at the bottom window.
That’s all about the first post on Installation of the Visual Studio. Through this post, we have learned to create the project in Visual Studio. I hope this basic post will assist you to understand how to create a new project in Visual Studio. If you face any problem during the installation then don’t forget to let me know through your comment. I will glad to assist you. Stay tuned to us for the next update on the VB.Net. Thank you 🙂