Open Windows Form only once in C #

advertisements

Possible Duplicate:
How to avoid multiple instances of windows form in c#

I want to show open form only once in an application without creating them as MDI form.


Before opening the form from your code, check the Application.OpenForms property and see if the form exists in the collection.

Something like:

if ((Application.OpenForms["Form1"] as Form1) != null)
{
 //Form is already open
}
else
{
// Form is not open
}