Make your own free website on
Make Your First ActiveX Control

Lesson 1
Tutorials - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14

Implementing events

We know what the user wants to pop up when he
clicks the button - the Text in TextVariable.
Now we need to pop up the message box when the user click the button.
We want 2 events: KeyPress and Click.
First we need to declare them. 
enter the following code to your form:

Event Click()
Event KeyPress(KeyAscii As Integer)

How do we know that the Click event not getting parameters,
and the KeyPress event get the KeyAscii parameter?
Double Click on the command button.
2 new lines have been inserted to your code:

Private Sub
End Sub

as you see, the Click event gets no parameters.
Now go to the button KeyPress event,
via the right ComboBox under the title bar,
which now showing the current event - Click

After you choose KeyPress from the combobox,
2 new lines were inserted to your code:

Private Sub Command1_KeyPress(KeyAscii As Integer)
End Sub

As you can see, the button KeyPress event get the KeyAscii parameter.

Back  Forward