PDA

Click to See Complete Forum and Search --> : [RESOLVED] MDI Child Problem


phrajib
Apr 3rd, 2006, 02:19 AM
Dear Friends,

Now I want to make a form child of another form that is mdiContainer.How can I do that?

Rajib

Shuja Ali
Apr 3rd, 2006, 02:46 AM
If Form1 is the MDI Parent then set the isMDIContainer property of the Form to True. Now if Form2 will act as a MDIChild, then you can use this code Form2 newForm = new Form2();
newForm.MdiParent = this;
newForm.Show();

phrajib
Apr 3rd, 2006, 03:48 AM
Dear Shuja,

Thanks for quick response. But I want that if child is open then parent must be inactive. here when the child is open the total application can be closed by clicking on close button of parent. But don't want that. i want that user must close child before close total application.

Can anybody help me ?

Rajib

jmcilhinney
Apr 3rd, 2006, 03:59 AM
What's the difference between closing the child and then the parent or just closing the parent? When you close the parent it raises an event in the child so you can prompt the user then to save any pending changes or whatever. If you really want to prevent the user closing the parent then you're going to have to handle that situation in the parent. Strictly speaking you should disable all the means of closing the parent, like menus, toolbars, titlebar, etc. Alternatively you could just handle the Closing (2003) or FormClosing (2005) event and cancel it if the child is open, but that is less professional. I really can't see a reason to prevent the parent closing though. I've never seen an app that does that. usually they just do as I suggested and prompt the user to save any pending changes before closing.

phrajib
Apr 3rd, 2006, 05:10 AM
Thanks for ur valuable suggetion. I was just confused. But u realy make me free. Thanks again.

Rajib