How to Use Visual Basic Express
The current version of Visual Basic Express (VBE) is 2008. If you already have VBE 2005, then with the exception of some enhancements, using either one involves essentially the same skills. If you are familiar with earlier versions of Visual Basic, picking up a basic knowledge of the Express edition is not difficult. Those brand new to programming will find the visual nature of the approach and the built-in tool set a help in getting up and running in a short time. The sample below introduces you to a number of the basic elements involved in using VBE to create programs.
Instructions
-
-
1
Download the free Visual Basic Express 2008 from the Microsoft Visual Studio Download page listed in the Resources section and follow the instructions to install the software.
-
2
Click on "Start," then "All Programs" and locate the installed program listed as Microsoft Visual Basic 2008 Express Edition. Click on this to start the program.
-
-
3
Click on "File," then "New Project" and choose "Windows Forms Application." In the empty box at the bottom, provide a name like "My First VB Program" and click "OK."
-
4
Display the Properties pane on the right by clicking on "View," then "Properties Window." The Tool pane should be showing on the left. If not, display it by repeating this step and clicking on "Toolbox" in the View drop down menu.
-
5
Double-click the Label tool in the Toolbox to place a label on the form you see. In the Properties pane, double-click on the Label Text property and type "Hello there, what is your name?"
-
6
Double-click on the Textbox control, and then drag it down below the Label you just created. Change the Width (under Size) property to 275. Double-click on the Button tool and then drag it below the Textbox. Change the Button Text property to "Continue."
-
7
Double-click on the Continue button to open the Code view. Type the following text between the line that begins "Private Sub Button1_Click" and the "End Sub" line:
Dim MyName As String
MyName = TextBox1.Text
TextBox1.Text = "Glad to meet you, " & MyName & ". My name is Zork." -
8
Click "Debug," then "Start Debugging" to test the program. If you entered the code correctly, you should see a dialog.
-
1
Tips & Warnings
Explore the Properties for each control you use. You will see many ways to enhance the appearance of the controls, from fonts, to colors, to borders and other options. Give the form a name by editing the Text property of the form itself.
Visual Basic Express, like all programming languages, is intolerant of coding errors. If you mistype something or try to use a control in an incorrect way, the program will not work.