Visual Basic 2008 is one of the latest versions of Visual Basic launched by Microsoft in 2008. The latest version is Visual Basic 2010, launched this year. VB2008 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, so it has caught up with other OOP languages such as C++, Java,C# and others. 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 syntax and interface are similar. Visual Basic 2008 Express Edition is available free for download from the Microsoft site. (OOP will be explained in Chapter 4). This
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.
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.
Now I am showing you how to create your first program. First of all, drag one common button into the form and change its default name to calculate.
Next, click on the calculate button and key in the following code at the source code window 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.