CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Events

  1. #1
    Join Date
    Sep 2001
    Posts
    4

    Events

    I´m going to build a Com-object (ActiveX-dll) with interfaces. How did I manage the events? (The implements feature does not support outgoing interfaces)
    Thanks for help!






  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Events

    Here's a very simple example that should help get you started.

    In a form module:

    option Explicit
    Dim withevents x as Class1
    private Sub Form_Load()
    me.Show
    set x = new Class1
    x.RunObject
    End Sub

    private Sub x_MyEvent()
    MsgBox "Event Fired"
    End Sub




    In a class module:

    option Explicit
    public Event MyEvent()

    public Sub RunObject()
    Dim x as Long
    for x = 1 to 10000
    DoEvents
    next
    RaiseEvent MyEvent
    End Sub






  3. #3
    Join Date
    Sep 2001
    Posts
    4

    Re: Events

    My question was a bit short.
    I have a IClass (interface) for the ingoing (properties and sub/function) and like to have a outgoing interface for the events (IClassEvent).
    I have a Class module where I Implement my IClass for the methods and properties. I declare my Event Public and Raise the Event.

    Then from the Client I like to declare two variables.

    [Private WithEvents mp_ClassEvent As Class
    Private mp_Class As IClass]

    and then Instantiate them.

    [Set mp_Class As Class
    Set mp_ClassEvent As Class]

    But the events didn´t fire.






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

Featured