• Visual Basic was first released in the year 1991 by Microsoft. 
  • It is a third-generation event-driven programming language.
  • It evolved from the earlier DOS version called BASIC (Beginners' All-purpose Symbolic Instruction Code).
  • Microsoft has released many versions of Visual Basic, it ranges from Visual Basic 1.0 to the final version Visual Basic 6.0. 

Basics of Visual Basic -

  • It is mainly designed for beginners as it is a user-friendly programming language. 
  • Visual Basic enables users to develop GUI window applications.
  • In the year 2002, Microsoft replaced released Visual Basic 6 to replace Visual NET(VB.NET).
  • Later in 2008, VB6 has declared a legacy programming language and even now Microsoft provides some form of support for VB6. 
  • NETis an object-oriented programming language which is created to cater to the development focusing on the web and mobile applications. 
  • As it has advantages many developers still favor Visual Basic 6.0 over its successor Visual NET.

Uses of Visual Basic 6 -

  • We can write many programs using VB 6 depending on our need and field. 
  • Let’s discuss on few areas where and how we can use Visual Basic effectively. 

Department of Mathematics -

Geometric Progression, Simultaneous Equation Solver, Prime Number Tester, Factors Finder are some of the mathematical programs that we can create. 

Department of Science -

Simulation programs such as Projectile, Simple Harmonic Motion, and Star War etc. are some of the science programs that we can create. 

Business -

This helps us to create an inventory management system, Amortization Calculator, investments calculator, point-of-sale system, payroll system, accounting program etc. 

We can create business applications which are more helpful to manage your business and increase productivity. 

Games & Entertainment -

Slot machine, reverse, tic tac toe and more games can be designed with VB program.

Multimedia programs such as Smart Audio Player, Multimedia Player etc can also be created. 



Visual Basic 6 Integrated Development Environment

Before we could write programs on VB 6, we need to install the Visual Basic 6 compiler on our computer.

After installing the vb6 compiler, the icon will appear on your desktop or in your programs menu.

Click on the icon to launch the VB6 compiler.



You can choose to either start a new project, open an existing project or

There are various types of applications that we could create, however, we shall concentrate on creating Standard EXE programs (EXE means executable).

The Visual Basic 6 Integrated Programming Environment is shown in the below picture which consists of the toolbox, the form, the project explorer and the properties window.



The Form is the primary building block of a Visual Basic 6 application.

A Visual Basic 6 application can actually comprise many forms, but we shall focus on developing an application with one form first.

You can save the project by selecting Save Project from the File menu, assign a name to your project and save it in a certain folder.

Creating your first application

Launch Microsoft Visual Basic 6 compiler.

In the New Project Dialog, choose Standard EXE to enter Visual Basic 6 integrated development environment.

In the VB6 IDE, a default form with the name Form1 will be presented to you. Next, double-click on Form1 to bring up the source code window for Form1.

The top of the source code window consists of a list of objects and their associated events or procedures.

In the source code window, the object displayed is Form1 and the associated procedure is Load.



When you click on the object box, the drop-down list will display a list of objects you have inserted into your form.

Here, you can see a form with the name Form1, a command button with the name Command1, a Label with the name Label1 and a Picture Box with the name Picture1.



Similarly, when you click on the procedure box, a list of procedures associated with the object will be displayed.



The control properties

To start with, before we write an event procedure for the control to respond to an event, you have to set certain properties for the control to determine its appearance and how will it work with the event procedure. You can set the properties of the controls in the properties window or at runtime.

For example, in order to change the caption, just highlight Form1 under the name Caption and change it to other names. You may also alter the appearance of the form by setting it to 3D or flat, change its foreground and background color, change the font type and font size, enable or disable, minimize and maximize buttons and more.



Writing the code -

To start writing code for an event procedure, you need to double-click an object to enter the VB code window.  



The structure of an event procedure is as follows:

Private Sub Command1_Click VB Statements End Sub

The syntax of the Visual Basic’s program code is almost like the normal English language, though not exactly the same.

Here the Object and Property are separated by a period (or dot).

For example,

Private Sub Command1_click()Label1.Visible=falseLabel2.Visible=TrueText1.Text="You are correct!" End sub

Visual Basic Data Types

We have access to all kind of data in your regular routine.

For example, we need to handle data such as names, addresses, money, date, stock quotes, statistics and more every day.

Likewise, in Visual Basic, we have to deal with all kind of data; These data can be mathematically calculated while some are in the form of text or other forms.

Visual Basic classifies information into two major data types, they are the numeric data types and the non-numeric data types.

Numeric Data Types

Numeric data types are types of data that consist of numbers that can be computed mathematically with standard operators. Examples of numeric data types are height, weight, share values, the price of goods, monthly bills, fees and others.

Numeric Data Types



Range of Values


 1 byte

  0 to 255


 2 bytes

  -32,768 to 32,767


 4 bytes

 -2,147,483,648 to 2,147,483,648


 4 bytes

-3.402823E+38 to -1.401298E-45 for negative values 1.401298E-45 to 3.402823E+38 for positive values.


 8 bytes

-1.79769313486232e+308 to -4.94065645841247E-324 for negative values 4.94065645841247E-324 to 1.79769313486232e+308 for positive values.


 8 bytes

-922,337,203,685,477.5808 to 922,337,203,685,477.5807


 12 bytes

+/- 79,228,162,514,264,337,593,543,950,335 if no decimal is use +/- 7.9228162514264337593543950335 (28 decimal places).

Non-numeric Data Types

Nonnumeric data types are data that cannot be manipulated mathematically. Non-numeric data comprises string data types, date data types, boolean data types that store only two values (true or false), object data type and Variant data type.

Nonnumeric Data Types

Data Type



String(fixed length)

Length of string

1 to 65,400 characters

String(variable length)

Length + 10 bytes

0 to 2 billion characters


8 bytes

January 1, 100 to December 31, 9999


2 bytes

True or False


4 bytes

Any embedded object


16 bytes

Any value as large as Double


Length+22 bytes

Same as variable-length string


Looping -

We can write a Visual Basic procedure that allows the program to run repeatedly until a condition or a set of conditions are met.

There are three kinds of loops in Visual Basic –

  • the Do...Loop
  • the For.......Next loop
  • the While.....Wend Loop

Case study -

Let’s now create a simple calculator using Visual Basic. 

To perform basic four arithmetic calculations we can use a combo box that includes four operators, addition, subtraction, multiplication and division. 

Use the below code:

Private Sub Combo1_()

Select Case Combo1.ListIndex

Case 0

Label1 = Str$(Val(Text1.Text) + Val(Text2.Text))

Case 1

Label1 = Str$(Val(Text1.Text) - Val(Text2.Text))

End Select

End Sub

Private Sub Command1_Click()

Select Case Combo1.ListIndex

Case 0

Label1 = Str$(Val(Text1.Text) + Val(Text2.Text))

Case 1

Label1 = Str$(Val(Text1.Text) - Val(Text2.Text))

Case 2

Label1 = Str$(Val(Text1.Text) * Val(Text2.Text))

Case 3

Label1 = Str$(Val(Text1.Text) / Val(Text2.Text))

End Select

End Sub

Private Sub Command2_Click()


End Sub

Private Sub Form_Load()

Combo1.AddItem "+"

Combo1.AddItem "-"

Combo1.AddItem "x"

Combo1.AddItem "รท"

Combo1.ListIndex = 1

End Sub




Introduction to Visual Basic

  • Visual Basic was first released in the year 1991 by Microsoft.
  • It is a third-generation event-driven programming language.

Basic & Uses of Visual Basic 6

Visual Basic 6 Integrated Development Environment

  1. Installing VB6
  2. Creating your first application
  3. The control properties
  4. Writing the code
  5. Visual Basic Data Types
  6. Looping