Results 1 to 3 of 3

Thread: event triggering

  1. #1

    Thread Starter
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930

    Question

    Is there a way to trigger an event on another form when that form isn't active? I've got a program with an MDI form and a few children, and I want to be able to fire an event in one of the children when the MDI form has the focus. (Specifically using an MDI menu to press a toolbar button on one of the child forms). I know that properties can be set with the syntax Form!Object.Property = Value, but that same thing won't work for firing events. Is it possible to do this?
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  2. #2
    Guest
    Just change it from Private Sub to Public Sub, for example:
    Code:
    Public Sub Command1_Click()
        MsgBox "Hello"
    End Sub
    Then from another Form, you can use:
    Code:
    Call Form2.Command2_Click()

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    Command1.Value = True
    will also trigger the commandbutton click event without setting it public
    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.

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