VB.NET Console Applications
- You can also create a console application in VB.NET.
- Console Applications are command-line based applications which read characters from the console and write character to the console and are executed in DOS Version.
- Now we will study how to create a console application in VB.NET:
- Open Microsoft Visual Studio 2010.
- Now click on File->New Project option. This will open a New Project dialog box in front of you.
- Now choose Visual Basic language and Console Application from the project pane and also give it the name “FirstConsoleApplication” as shown in figure:
- A console application does not have a form window. It only contains a code-behind file as shown in figure given below:
- Now add the following highlighted code to code behind file of console application that is Module.1vb:
- In the above code WriteLine method of the Console class is used to display a message on the console and the ReadLine method of the Console class is used to read the next line of characters from the console.
- Now press F5 key to run the application. The application will produce the following output:
Console.WriteLine("My First Visual Basic.NET Console Application")