المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to avoid closing mdiparent form while we close mdichild.?



C# Programming
05-06-2011, 08:10 AM
In Form2 Properties I set - IsMDIContainer = True. And Form3 is MdiChild with Formborderstyle=None. MdiPaarent Form2 is having Toolstrip Hence while I dock its possible to see from all mdichild forms. And my problem is when I click the close button, it's also closing the MDIParent. But I need to close only mdichild... for that I tried as like Vb.Net2008 style by the following codes placed in MDIParent Form2, Its not working. Any right directions ...
private void toolStripButton1_Click(object sender, EventArgs e) { Form3 NwMdiChild2 = new Form3; NwMdiChild2.MdiParent = this; NwMdiChild2.Dock = System.Windows.Forms.DockStyle.Fill; NwMdiChild2.Show(); } private void Form2_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) { Form[] MdiChildForms = this.MdiChildren; int kkk1 = MdiChildForms.Length; int x = 0; for (x = 0; x 0) { // For Not Closing e.Cancel = true; } else { // For Closing e.Cancel = false; Application.Exit(); } }
Any Right Directions for Me?
Thanks For Reply