Make Your First ActiveX Control

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

Implementing The KeyPress Event
We don't want to change the KeyPress Event.
We want that the code the user will insert to the
KeyPress Event (Image 11) will be launched as usual,
without any changes.

Image 11:


So we will enter the following lines to our form:

Private Sub Command1_KeyPress(KeyAscii As Integer)
    RaiseEvent KeyPress(KeyAscii)
End Sub

Code Explanation: when the user press on the Command1 Button,
simply launch the Control (MyControl) KeyPress event.
The 'RaiseEvent' function launch an event.
It launch the event with the KeyAscii parameter that has been
received from the Command1 KeyPress event.

Back  Forward