Closing Forms automatically
hi guys...i have a small doubt... imagine i have
three forms f1,f2 and f3.... if i click a
button in f1,, f2 and f3 should be closed
automatically.... how to do this?.... thanks ...
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Apr 2, 2009, 9:51 PM EDT
To close all Mdi child forms from code within the Mdi parent itself, you can use:
foreach (Form f in this.MdiChildren)
{
f.Close();
}
To close them from some other form, replace 'this' with a reference to the Mdi Parent form.
To open another form, just create an instance of it and call the Show() or ShowDialog() methods on that instance, depending on whether its modal or not.
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Apr 2, 2009, 10:03 PM EDT
You also can refer the following Article:
http://www.csharp411.com/close-all-forms-in-a-thread-safe-manner/
csharp rocks8 reputationPosted Apr 3, 2009, 9:09 PM EDT