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 ...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
csharp rocksPosted Apr 4, 2009, 1:09 AM
Niradhip ChakrabortyPosted Apr 3, 2009, 2:03 AM
You also can refer the following Article:
http://www.csharp411.com/close-all-forms-in-a-thread-safe-manner/
Niradhip ChakrabortyPosted Apr 3, 2009, 1:51 AM
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.