Visual Basic 2008 is the version of Visual Basic launched by Microsoft in 2008. Visual Basic 2008 is almost similar to Visual Basic 2005 but it has added many new features. Visual Basic 2008 is a full fledged Object-Oriented Programming(OOP) Language. However, you don't have to know OOP to learn VB2008. In fact, if you are familiar with Visual Basic 6, you can learn VB2008 effortlessly because the syntaxes and interface are similar. Visual Basic 2008 Express Edition is available free for download from the Microsoft site. (OOP will be explained in lesson 4).
The Integrated Development Environment when you launch Visual Basic 2008 Express is shown in Figure 1.1 below. The IDE consists of a few panes, namely:
To start creating your first application, you need to click on file and select new project. The following VB2008 New Project dialog box will appear, as shown in Figure 1.2.
The dialog box offers you five types of projects that you can create. As we are going to learn to create windows Applications, we will select Windows Forms Application
At the bottom of this dialog box, you can change the default project name WindowsApplication1 to some other name you like, for exampe, MyFirstProgram. After you have renamed the project, click OK to continue. The following IDE Windows will appear, it is almost similar to Visual Basic 6. It consists of an empty form, the common controls toolbox, the solution explorer and the properties, as shwon in Figure 1.3
Now we will show you how to create your first program. First of all, drag one common button into the form and change its default name to calculate, as shown in Figure 1.4
Next, click on the calculate button and key in the following code at the source code window(Figure 1.5) as shown below
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, sum As Single
num1 = 100
num2 = 200
sum = num1 + num2
MsgBox(" The Sum of " & num1 & " and " & num2 & " is " & sum)
Now run your first application! And you can see the follow message box showing the sum of two numbers,as shown in Figure 1.6