Results 1 to 3 of 3

Thread: [RESOLVED] WithEvents in ActiveX DLL Class problem

  1. #1

    Thread Starter
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Resolved [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?


  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    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

  3. #3

    Thread Starter
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    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'

    Thank you anyway!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width