Click here to Skip to main content
15,905,233 members
Home / Discussions / C#
   

C#

 
GeneralRe: windows service scheduler Pin
arkiboys19-Jun-07 22:37
arkiboys19-Jun-07 22:37 
GeneralRe: windows service scheduler Pin
Manas Bhardwaj19-Jun-07 22:39
professionalManas Bhardwaj19-Jun-07 22:39 
GeneralRe: windows service scheduler Pin
arkiboys19-Jun-07 22:58
arkiboys19-Jun-07 22:58 
GeneralRe: windows service scheduler Pin
arkiboys19-Jun-07 23:04
arkiboys19-Jun-07 23:04 
GeneralRe: windows service scheduler Pin
SimulationofSai20-Jun-07 0:18
SimulationofSai20-Jun-07 0:18 
AnswerRe: windows service scheduler Pin
Joseph Guadagno20-Jun-07 4:08
Joseph Guadagno20-Jun-07 4:08 
QuestionXAML extension question Pin
Super Lloyd19-Jun-07 21:44
Super Lloyd19-Jun-07 21:44 
QuestionData Encrypt and Decrypt? Pin
mimilaw19-Jun-07 21:35
mimilaw19-Jun-07 21:35 
AnswerRe: Data Encrypt and Decrypt? Pin
Sathesh Sakthivel19-Jun-07 21:55
Sathesh Sakthivel19-Jun-07 21:55 
QuestionHow to import ActiveX control in the form? [modified] Pin
$uresh $hanmugam19-Jun-07 21:24
$uresh $hanmugam19-Jun-07 21:24 
AnswerRe: How to import ActiveX control in the form? Pin
Mali Perica19-Jun-07 21:44
Mali Perica19-Jun-07 21:44 
QuestionRegd Serialization Pin
vikasviswan19-Jun-07 21:10
vikasviswan19-Jun-07 21:10 
AnswerRe: Regd Serialization Pin
Sandeep Akhare19-Jun-07 21:24
Sandeep Akhare19-Jun-07 21:24 
AnswerRe: Regd Serialization Pin
Sathesh Sakthivel19-Jun-07 21:34
Sathesh Sakthivel19-Jun-07 21:34 
AnswerRe: Regd Serialization Pin
PandemoniumPasha20-Jun-07 0:21
PandemoniumPasha20-Jun-07 0:21 
QuestionRe: Regd Serialization Pin
vikasviswan20-Jun-07 0:30
vikasviswan20-Jun-07 0:30 
Questionmouse hook [modified] Pin
trecee_jhnsn19-Jun-07 20:27
trecee_jhnsn19-Jun-07 20:27 
Questiongetting data via DialUp Pin
Assaf Dar19-Jun-07 19:30
Assaf Dar19-Jun-07 19:30 
QuestionMDI Closing Statement Pin
*** AAMP ***19-Jun-07 19:16
*** AAMP ***19-Jun-07 19:16 
AnswerRe: MDI Closing Statement Pin
Nouman Bhatti19-Jun-07 20:20
Nouman Bhatti19-Jun-07 20:20 
GeneralRe: MDI Closing Statement Pin
*** AAMP ***19-Jun-07 22:34
*** AAMP ***19-Jun-07 22:34 
AnswerRe: MDI Closing Statement [modified] Pin
gumi_r@msn.com19-Jun-07 23:54
gumi_r@msn.com19-Jun-07 23:54 
The easiest way is handling all the closing logic by yourself and not rely on the Form's events. The order in which they are fired when closing an MDIParent window will not let you do what you want. As far as I know, unless they've changed it, you will be getting the Closing events of all the MDI child forms before you get the Closing event of the MDIParent, which is exactly the opposite of what you want.

This is a problem because normally all your logic linked to a closing form like for example requesting user validation in order to close, save, cancel, whatever, is linked to the Closing event, so you would have all these features popping up for each open MdiChild before you can do anything in your MdiParent Closing event.

Fortunately, its easy to solve: In pseudo code it would be something similar to this:

In your MdiParent Form:>

protected override void WndProc(ref Message m)
{
If m.Msg is WM_CLOSE (0x0010):
{
Show dialog window with closing options >> yes, no, no to all and store result in Answer
If Answer is cancel then m.Result = IntPrt.Zero and return without calling base WndProc.
Otherwise do all logic and supress closing warning messages on each MDI child form if necessary. (You'll need to code some kind of flag that will let you disable closing validation messages on your child forms. Then you simple iterate the MdiChildren collection disabling the flag)
}

Call base WndProc.
}

This way you have the advantage of handling the main form closing event before your mdichilds close 1 by 1. If this is the behaviour you always want then you are done.


-- modified at 5:59 Wednesday 20th June, 2007
Questioncan u convert this vb.net code into c#.net Pin
srinivassam19-Jun-07 18:45
srinivassam19-Jun-07 18:45 
AnswerRe: can u convert this vb.net code into c#.net Pin
Christian Graus19-Jun-07 19:05
protectorChristian Graus19-Jun-07 19:05 
Questionwriting to appconfig file Pin
justintimberlake19-Jun-07 18:41
justintimberlake19-Jun-07 18:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.