Results 1 to 5 of 5

Thread: RaiseEvent from a form (in and ActiveX dll project)

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Question

    I need to do a RaiseEvent for one of the Class modules in this project I'm working on. The catch is the the class shows a form, and the form needs to interact with the program that called the dll. I'd like to do this through events, but I can't seem to figure out how to RaiseEvent from the form. (BTW, there are several forms and several class modules in the DLL project)

    I was thinking that I might need to use a Friend sub to do this. Anybody know if that would work, or a better way to RaiseEvent from a form?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You use Raisevent in the Class that raises the event, not the form.

    You declare an event in your class:

    Code:
    Public Event Yourevent
    then you raise the event in your class
    Code:
    Raisevent Yourevent
    You declare the class in your form:
    Code:
    Public withevents yourobj as yourclass
    Then you can select your object from the object list combo and you have the event
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662
    God damn, that was a fast reply!!! Not what i'm looking for. The dll that's calling the class uses the Dim withevents thing. When the classes form is show, it has a button on it. When that button is clicked, i want the class object to send the Click event back to the program that's calling the AcitveX dll.

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Then define the event in the form eg.
    Event ButtonClicked
    and call it when the button is clicked:
    RaiseEevent ButtonClicked

    You need to make sure you dim the form in the class with WithEvents, then you should see the form in the object-dropdown box (left dropdown box), and the event in the right dropdownbox inthe code editor. Basically it works the same as with classes (since a form is a class).
    Oh I assume you know that when you dim the form withevents, you need to Set fFormVar = New MyForm and also call that fFormVar.Show
    Hope this helps

    Crazy D

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662
    You're a ****ing genius!!! This look like it should work. I'll post any problems I have with it to this thread.

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