ActiveX Events
-
Hi ! I have an app (developped with VB6) which is dynamically creating several instances of the same ActiveX. Here is how I do it :
Dim objFoo(3) As Object Private Sub Form_Load() Set objFoo(1) = Form1.Controls.Add("MyOCX.MyActiveX", "object0") Set objFoo(2) = Form1.Controls.Add("MyOCX.MyActiveX", "object1") Set objFoo(3) = Form1.Controls.Add("MyOCX.MyActiveX", "object2") objFoo(1).Visible = True objFoo(2).Top = 2000 objFoo(2).Visible = True End Sub
The problem is that the ActiveX is raising an event in some situations. How can I handle this event in my app, and how will I know which instance of the ActiveX raised the event ? Thank you for your help ! Jerome -
Hi ! I have an app (developped with VB6) which is dynamically creating several instances of the same ActiveX. Here is how I do it :
Dim objFoo(3) As Object Private Sub Form_Load() Set objFoo(1) = Form1.Controls.Add("MyOCX.MyActiveX", "object0") Set objFoo(2) = Form1.Controls.Add("MyOCX.MyActiveX", "object1") Set objFoo(3) = Form1.Controls.Add("MyOCX.MyActiveX", "object2") objFoo(1).Visible = True objFoo(2).Top = 2000 objFoo(2).Visible = True End Sub
The problem is that the ActiveX is raising an event in some situations. How can I handle this event in my app, and how will I know which instance of the ActiveX raised the event ? Thank you for your help ! JeromeInstead of using an array of objects, use the VBControlExtender class. Declare it WithEvents and you will be able to receive events. You identify the object by its Name. -- David Wengier Sonork ID: 100.14177 - Ch00k