Make Your First ActiveX Control

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

Implementing The Click Event
We want to pop up the message box when the
Click event occur, and then run the code that
the user entered in the MyControl1 - Click event.

Enter the following code to your form:

Private Sub Command1_Click()
    MsgBox (TextVariable)
    RaiseEvent Click
End Sub

When the user Click on Command1, pop up a message box
with the TextVariable string.
Then run the code that the user inserted to the control Click event.
What will happen if you omit the 'RaiseEvent Click' line?
When the user will click the button, the message box will pop up,
and the code that the user entered to the MyControl1 Click
event will not be apply.
So actually the user will not be able to program the click event.

Back  Forward