[RESOLVED] WithEvents in ActiveX DLL Class problem
My situation can be best described as something like this:
Code:
Standard EXE (EXE1)
Form1
DLL1.Class1.Sub1(Me)
ActiveX DLL (DLL1)
Class1
Sub1(ByRef Owner)
Class2.Sub1(Owner)
Class2
Private WithEvents m_frmOwner As Form
Sub1(ByRef Owner)
When i try to run the 'EXE1' i get the 'Object or class does not support the set of events' error.
I should mention i really need that 'WithEvents' on 'm_frmOwner' in 'Class2'.
Am i missing something?
:wave:
Re: WithEvents in ActiveX DLL Class problem
Where does the error occur? This works for me
Code:
Form1 code
Option Explicit
Dim objClass1 As Project1.Class1
Private Sub Command1_Click()
Set objClass1 = New Class1
objClass1.Sub1 Me
End Sub
Class1 code
Option Explicit
Private objCls As Project1.Class2
Public Sub Sub1(ByRef Owner)
Set objCls = New Class2
objCls.Sub1 Owner
End Sub
Clas2 code
Option Explicit
Private WithEvents m_frmOwner As Form
Public Sub Sub1(ByRef Owner)
Set m_frmOwner = Owner
End Sub
Private Sub m_frmOwner_Resize()
m_frmOwner.Caption = m_frmOwner.Width
End Sub
Re: WithEvents in ActiveX DLL Class problem
It turned out that everything was generally OK with both codes... the problem is that 'Form1' is a 'MDIForm'... and 'm_frmOwner' is declared as a 'Form' instead of a 'MDIForm' :blush:
Thank you anyway! :wave: