Make your own free website on
Write Your First Visual Basic Program

Lesson 1
Tutorials - Page 1 - Page 2 - Page 3 - Page 4 - Page 5 - Page 6 - Page 7 - Page 8 - Page 9 - Page 10 - Page 11

Learning about Events
Visual Basic is "Event Driven" language.
What does it mean?

Everything that happening, launch an event.
You've moved the mouse? The "MouseMove" event has been launched.
You've pressed a key? The "KeyPress" event has been launched.

You can program the events.
When the mouse moves, you can change the Form's color (for example),
and when a key is pressed, You can play a MP3 file.

To start programming the events, double click on the form.
You will see the "Code Window" (Figure 20).

Figure 20

The Code Window opened with the Form_Load event.
The Form_Load event occurs when the form is loaded, and this happening
when you start the program.
So the code that you will enter to the Form_Load event will be launched
when the program is being started.

The code that belongs to the Form_Load event should be placed
between Private Sub Form_Load()    and    End Sub

The Form_Load event should look like this:

Private Sub Form_Load() (The beginning of the Form_Load event)
This is the code that belongs to the Form_Load event
End Sub
(The end of the Form_Load event)

Back  Forward