Visual Basic 2008 Tutorial

Lesson1: Introduction

[Home] >>[Lesson2]

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. 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 Chapter 4).

The Integrated Development Environment when you launch VB2008 Express is shown in the diagram below. The IDE consists of a few panes, namely:

  • The Recent Projects Pane- it shows the list of projects that have been created by you recently.
  • The Getting Started Pane- It provides some helpful tips to quickly develop your applications.
  • The VB Express Headlines pane- It provides latest online news about Visual Basic 2008 Express. It will announce new releases and updates


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)

End Sub

Now run your first application! And you can see the follow message box showing the sum of two numbers.

  Bookmark and Share

[Home] >>[Lesson2]

Copyright® Dr.Liew Voon Kiong   Contact Privacy Policy]