Classic VB, commonly known as Visual Basic 6 (VB6), is a programming language released by Microsoft in 1998. It became extremely popular because it allowed beginners to create Windows applications with drag‑and‑drop tools and simple code.
Although modern Visual Basic .NET replaced it, many legacy business applications still use VB6 today.
VB6 applications are usually built using forms. But you can also write a simple message box:
Private Sub Form_Load()
MsgBox "Hello, world!"
End Sub
This code runs automatically when the form loads and shows a message box.
Dim message As String
message = "Welcome to VB6!"
If score > 50 Then
MsgBox "You passed!"
Else
MsgBox "Try again."
End If
For i = 1 To 5
Print i
Next i
VB6 uses a form designer where you drag controls such as:
Example: A button that shows a greeting when clicked:
Private Sub Command1_Click()
MsgBox "Hello from VB6!"
End Sub
You might want to learn VB6 if:
If you're starting fresh, modern languages like C#, Python, or VB.NET may be better for long‑term development—but VB6 remains simple and fun for beginners.
Variables store information. VB6 requires you to declare them using Dim.
Dim age As Integer
Dim name As String
Dim price As Currency
age = 25
name = "Alice"
price = 19.99
Forms are windows in your application. You can change properties in the Properties panel or in code.
Private Sub Form_Load()
Me.Caption = "My First VB6 App"
Me.BackColor = vbYellow
End Sub
Events run automatically when the user interacts with your program.
Private Sub Command1_Click()
MsgBox "You clicked the button!"
End Sub
Private Sub Text1_Change()
Label1.Caption = Text1.Text
End Sub
Arrays store multiple values under one name.
Dim nums(4) As Integer ' Holds 5 values: 0-4
nums(0) = 10
nums(1) = 20
nums(2) = 30
VB6 can save and read files very easily.
' Writing to a file
Open "example.txt" For Output As #1
Print #1, "Hello VB6!"
Close #1
' Reading from a file
Open "example.txt" For Input As #1
Line Input #1, textLine
Close #1
MsgBox textLine
Modules store reusable functions and procedures.
' In Module1.bas
Public Function Add(a As Integer, b As Integer) As Integer
Add = a + b
End Function
These diagrams show the basic layout of the VB6 Integrated Development Environment.
+-----------------------------------------------------------+
| Menu Bar |
+-----------------------------------------------------------+
| Toolbox | Form Designer |
| | [ Drag controls here to build your UI ] |
| | |
+---------+-------------------------------------------------+
| Properties Window (Bottom) |
+-----------------------------------------------------------+
+--------- Toolbox ---------+
| Pointer |
| Label |
| TextBox |
| CommandButton |
| PictureBox |
| Timer |
| ListBox |
| ComboBox |
+---------------------------+
+------------------- Form Designer -------------------+
| +-----------------------------------------------+ |
| | [ Button ] | |
| | | |
| | [ TextBox ] | |
| | | |
| +-----------------------------------------------+ |
+-------------------------------------------------------+