471,356 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

Closing an MDI Parent Form

I have created an mdi parent form with four children. I want to disable
closing the four children but allow closing the parent form. I created a
FormClosing event on each form. That event tests to see who the sender is.
If it is the appropriate child form the close is disabled and a message box

The problem is on the FormClosing event for the parent. It goes immediately
to the first child form and displays the message box, then it allows the
parent form to close. How do I stop this event from going immediately to the
child form?

Here is the code for the FormClosing event on the parent:

private void frmMyForm1_FormClosing(object sender, FormClosingEventArgs e)
string strSender = sender.ToString();

int intIndex = strSender.IndexOf("frmMyForm1", 0,

if (intIndex > -1)
e.Cancel = false;
Jul 22 '05 #1
0 1008

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Ron L | last post: by
1 post views Thread by Chris Bruce | last post: by
6 posts views Thread by Gary Miller | last post: by
5 posts views Thread by Sherwood Page | last post: by
6 posts views Thread by Barry Gast | last post: by
reply views Thread by Kathy D | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.