Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-2006, 02:46 PM
hoser2001's Avatar   
hoser2001 hoser2001 is offline
Programmer
 
Join Date: Jul 2006
Posts: 175
Rep Power: 9
hoser2001 is on a distinguished road
Default 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??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-21-2006, 08:28 PM
smith smith is offline
Programmer
 
Join Date: Jun 2006
Posts: 108
Rep Power: 8
smith is on a distinguished road
Default

How can you add an event for FormB's event from FormA? Is that even possible?
__________________
Code:
for (int i;;) {
   cout << "Smith";
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-22-2006, 05:17 AM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 10
brackett is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-22-2006, 07:25 AM
hoser2001's Avatar   
hoser2001 hoser2001 is offline
Programmer
 
Join Date: Jul 2006
Posts: 175
Rep Power: 9
hoser2001 is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -5. The time now is 11:40 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 66%

Ads