Diegogo123
Technical User
I am trying to RaiseEvent from a button, this button is located in a Form. Then the idea is to raise the final even to the usercontrol.
I have tried the next code:
Form
Public Event TestEvent()
Private Sub Command1_Click()
RaiseEvent TestEvent
End Sub
usercontrol
Event clicked()
Option Explicit
Dim WithEvents f1 As Form1
Private Sub f1_TestEvent()
RaiseEvent clicked
End Sub
Private Sub UserControl_Initialize()
Set f1 = New Form1
End Sub
And unfortunately it is not working as I expect.
I hope my question is clear. Thanks
I have tried the next code:
Form
Public Event TestEvent()
Private Sub Command1_Click()
RaiseEvent TestEvent
End Sub
usercontrol
Event clicked()
Option Explicit
Dim WithEvents f1 As Form1
Private Sub f1_TestEvent()
RaiseEvent clicked
End Sub
Private Sub UserControl_Initialize()
Set f1 = New Form1
End Sub
And unfortunately it is not working as I expect.
I hope my question is clear. Thanks