The first thing you must do is create a new Visual Basic project. Visual Studio Community provides a wizard to help you do that. Start Visual Studio Community and from the window that opens (Figure 1), click on the āCreate a new projectā button.

Alternatively, if you click on the āContinue without codeā link, then, from Visual Studioās main menu you can select āFile ā New ā Projectā as shown in Figure 2.

The āCreate a new projectā dialog box appears. In the right pane, select āConsole Appā (prefer the one that can run on .NET Core on Windows, Linux and MacOS) as shown in Figure 3, and click on the āNextā button.

In the āConfigure your new projectā window that opens (see Figure 4), in the āProject nameā field, you need to enter the name of your project. Type ātestingProjectā and click on the āCreateā button.

In the next dialog box that appears, select the ā.NET 8.0 (Long-term support)ā framework.
The project is created and opened in your Visual Studio environment. You should see the following components (Figure 5):
- the āSolution Explorerā window, which contains a tree view of the components of the projects, including source files, libraries that your code may depend on, and so on
- the āSource Editorā window with the file called āProgram.vbā open. In this file you can write your Visual Basic code. Of course, one single project can contain many such files
- the āOutputā window in which Visual Studio displays messages useful for the programmer
- other windows, such as the āPropertiesā window.

You have just seen how to create a new Visual Basic console project. Letās now write the following (terrifying, and quite horrifying!) Visual Basic program and try to execute it.
Imports System
Module Program
Sub Main(args As String())
Console.WriteLine("Hello World!")
Console.WriteLine("Hallo Welt!")
Console.WriteLine("Bonjour le Monde!")
End Sub
End Module
The statement that displays the English message āHello World!ā has been already entered for you automatically. Place your text cursor at the end of that line and hit the āEnter ⤶ā key. Letās try to type the second statement, the one that displays the German message āHallo Welt!ā. Type only the first character, āCā, from the Console statement by hitting the āCā key on your keyboard. A popup window appears, as shown in Figure 6. This window contains all available Visual Basic statements, and other items that begin with the character āCā.

You can highlight a selection by using the up and down arrow keys on your keyboard.
Type the second character, āoā, from the Console statement. Now the options have become fewer. Select the option “Console” using the down arrow key from your keyboard (if necessary), as shown in Figure 7.

Hit the period āĀ .Ā ā key. The statement is automatically entered into your program. Select the “WriteLine” option as shown in Figure 8 and hit the āopening parenthesis (ā key.

Complete the statement by writing Console.WriteLine("Hallo Welt!").Then, continue typing the rest of the Visual Basic program (as shown in Figure 9). Save the changes that you have just made. Your Visual Studio Code environment should look like this.

And now, letās try to execute it! From the main menu, select “Debug ā Start Without Debugging”.
The Visual Basic program executes, and the output is displayed in the “Debug Console” window, as shown in Figure 10.

Notice: Alternatively, you can execute a file by hitting the CTRL + F5 key combination.
Congratulations! You have just written and executed your first Visual Basic program!
Notice: You should always save your changes before executing a program. To do so, from Visual Studioās main menu you can select āFile ā Saveā or hit the āCTRL + Sā key combination!
Now letās write another Visual Basic program, one that prompts the user to enter their name. Type the following Visual Basic program into Visual Studio and hit CTRL + F5 to execute the file.
Imports System
Module Program
Sub Main(args As String())
Dim name As String
Console.Write("Enter your name: ")
name = Console.ReadLine()
Console.WriteLine("Hello " & name)
End Sub
End Module
Once you execute the program, the message āEnter your name:ā is displayed in the āDebug Consoleā window. The program waits for you to enter your name, as shown in Figure 11.

Type your name and hit the āEnter ⤶ā key. Once you do that, your computer continues executing the rest of the statements. When execution finishes, the final output is as shown in Figure 12.

Press any key to close the window.