Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to raise an event from vb6 Form to a usercontrol? 1

Status
Not open for further replies.

Diegogo123

Technical User
Aug 21, 2022
2
0
0
CA
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
 
>it is not working as I expect.

Perhaps you can outline how you were expecting it to work

You could start by explaining how the user control is being hosted
 
Hello strongm, thanks a lot for your answer.
I found the issue.
The third-party software cannot run in parallel VB scripts.
Meaning that, if I want it to execute a new VB script(in the third-party software) I must close the Form, and then it will execute the event "clicked".
So, its a limitation in the third-party software and not really an issue in the script.
Once more thanks a lot for your answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top