Open only one child form
-
I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open. I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ? Interfaces - Is the folder Name where all forms are located frmPerson - is the child form (requered form to open) private void mnuManagePerson_Click(object sender, System.EventArgs e) { if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null) { Form frmchildfrmPerson=new Interfaces.frmPerson(); frmchildfrmPerson.MdiParent = this; frmchildfrmPerson.Show(); } } Cool Joe "Only the best" South Africa -- modified at 5:12 Friday 17th March, 2006
-
I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open. I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ? Interfaces - Is the folder Name where all forms are located frmPerson - is the child form (requered form to open) private void mnuManagePerson_Click(object sender, System.EventArgs e) { if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null) { Form frmchildfrmPerson=new Interfaces.frmPerson(); frmchildfrmPerson.MdiParent = this; frmchildfrmPerson.Show(); } } Cool Joe "Only the best" South Africa -- modified at 5:12 Friday 17th March, 2006
Make the base class of your child form to implement the singleton pattern
-
I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open. I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ? Interfaces - Is the folder Name where all forms are located frmPerson - is the child form (requered form to open) private void mnuManagePerson_Click(object sender, System.EventArgs e) { if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null) { Form frmchildfrmPerson=new Interfaces.frmPerson(); frmchildfrmPerson.MdiParent = this; frmchildfrmPerson.Show(); } } Cool Joe "Only the best" South Africa -- modified at 5:12 Friday 17th March, 2006
hi all i have a sample code this will solve your problem take a form and ToolStripMenuItem from vs toolbox duble click on opentoolstrip and write these code private void openToolStripMenuItem_Click(object sender, EventArgs e) { openToolStripMenuItem.Enabled = false; Form2 frm = new Form2(); frm.MdiParent = this; frm.FormClosed += new FormClosedEventHandler(frm_FormClosed); frm.Show(); } void frm_FormClosed(object sender, FormClosedEventArgs e) { openToolStripMenuItem.Enabled = true; }