CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2000
    Posts
    737

    raise event from module

    is there a way for us to raise a class module event from standard module function ? thanks.


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: raise event from module

    ??
    the "event" in class module should not be public function or public sub
    when triggered form other module/form?
    "event" keyword is not reseved to declare a component as withevent and then activating code where you declare the component?
    ??
    in other words, what are you trying to do?

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: raise event from module

    You can't raise an event outside the class it is declared in. You could however add a sub to the class which will raise the event for you.

    ' this is class1
    public Event MyEvent()
    public Sub RaiseMyEvent()
    RaiseEvent MyEvent
    End Sub

    ' this is code elsewhere, wherever the event should be raised
    Dim c as new Class1
    c.RaiseMyEvent




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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