Using Microsoft Visual Basic
The Microsoft Visual Basic compiler is available as part of Microsoft Visual Studio in all campus computer labs. If you'd like to own a personal copy of Visual Studio, see the instructions here.
These steps show you how to compile and execute a Visual Basic program.
- Start Microsoft Visual Studio.
- Choose File | New |
Project and you will see this screen:
- Click on Visual Basic in the left pane and click on Windows Forms Application in the right pane. Be sure that the top button says .NET Framework 4. Fill in the project name (Name:) and click the Browse button to select a directory for your project. Select a location on your personal hard disk or on a USB flash drive in a computer lab. A new folder will be created in that directory with the project's name. Be sure that the two boxes at the bottom ("Create directory for solution" and "Add to source control") are not checked. Then click OK. For this example, we assume drive E is the flash drive we are using.
You will see a Solution Explorer window like the following:
You might see the form designer immediately. If not, there are two ways to open the design view of the form:
a. click on Form1.vb and then select Designer from the View menu;
b. right-click on Form1.vb and then select View Designer from the pop-up menu
- To compile your program, click Build | Build Solution.
- If there are error messages in the bottom window, double-click on each message to go to the location of the error in your file. Fix the errors and build your program again.
- Execute your program by pressing F5 or clicking Debug | Start Debugging.
Use one of the following strategies to return to your project after closing Visual Basic:
- double-click the solution file (which ends in extension .sln) in the project folder, or
- choose Open | Project/Solution from the File menu and choose the solution file (ends in .sln), or
- select the project from Recent Projects at the bottom of the File menu.