FormCollection fc = Application.OpenForms;
foreach (Form frm in fc)
{
//iterate through
}
OR
Form fc = Application.OpenForms["FORMNAME"]; if (fc != null) fc.Close(); fm.Show();
but non of this works in compact framework 3.5. How can i check if form is already opened in CF 3.5?
As @Barry wrote, you will have to do it yourself. Easiest way is to use a dictionary. Your key can be a form’s type, its name, or whatever you need.
Or, if you want to support multiple form types and want to avoid casting, use a generic method:
There are two generic overloads. One of them is used like this:
or, if you need to pass parameters to your form during init: