Closed Thread
Results 1 to 4 of 4

Thread: Question about Form's On_Closing event

  1. #1
    hoser2001's Avatar
    hoser2001 is offline Programmer
    Join Date
    Jul 2006
    Posts
    175
    Rep Power
    0

    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. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

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

  4. #3
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    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.

  5. #4
    hoser2001's Avatar
    hoser2001 is offline Programmer
    Join Date
    Jul 2006
    Posts
    175
    Rep Power
    0
    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

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find Form's Location
    By DenKain in forum C# Programming
    Replies: 3
    Last Post: 10-04-2011, 11:31 AM
  2. How can I cycle through form's elements?
    By Alhazred in forum JavaScript and CSS
    Replies: 1
    Last Post: 01-13-2011, 10:34 AM
  3. event planner website question
    By the_code_charmer in forum Website Design
    Replies: 6
    Last Post: 10-30-2010, 01:06 AM
  4. Simple Forms Question using Resize Event
    By vt2009 in forum C# Programming
    Replies: 1
    Last Post: 10-17-2010, 12:50 AM
  5. question to know the event in which image?
    By stack in forum Java Help
    Replies: 10
    Last Post: 09-11-2007, 01:25 PM

Tags for this Thread

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