+ Reply to Thread
Results 1 to 4 of 4

Thread: Question about Form's On_Closing event

  1. #1
    Programmer hoser2001 is an unknown quantity at this point hoser2001's Avatar
    Join Date
    Jul 2006
    Posts
    175

    Question about Form's On_Closing event

    Say I have two Forms FormA and FormB

    In FormA I add an event handler for FormB's On_Closing event.

    If I have code in FormB's On_Closing event in both FormA and FormB, does one get executed before the other? What happens??

  2. #2
    Programmer smith is an unknown quantity at this point
    Join Date
    Jun 2006
    Posts
    153
    How can you add an event for FormB's event from FormA? Is that even possible?
    Code:
    for (int i;;) {
       cout << "Smith";
    }

  3. #3
    Programmer brackett is on a distinguished road
    Join Date
    May 2006
    Posts
    193
    AFAIK, there is no order guaranteed for called event handlers. They're likely to be called in whatever order they're attached in - but it's probably not something you want to depend on.

    If you wanted FormB's handler to run first, your better bet would be to override the Form.OnClosing function and perform your logic there instead of wiring the event.

  4. #4
    Programmer hoser2001 is an unknown quantity at this point hoser2001's Avatar
    Join Date
    Jul 2006
    Posts
    175
    Quote Originally Posted by smith View Post
    How can you add an event for FormB's event from FormA? Is that even possible?
    Form frmAddOrgSystem = new frmAddOrgSystem();
    frmAddOrgSystem.Closing += new System.ComponentModel.CancelEventHandler(this.frmA ddOrgSystem_Closing);
    frmAddOrgSystem.ShowDialog();

    And thanks for the explanation brackett

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Using variables in different forms question
    By skilletsteve in forum Visual Basic Programming
    Replies: 2
    Last Post: 08-31-2006, 10:39 AM
  2. Windows Forms MDI question.
    By hoser2001 in forum C# Programming
    Replies: 10
    Last Post: 08-11-2006, 06:36 PM
  3. How do you make forms in a dll
    By MrDiaz in forum Pascal/Delphi
    Replies: 0
    Last Post: 07-03-2006, 06:12 PM

Bookmarks

Posting Permissions

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