I'am trying to detect opened forms in C# with this code;
if ((Application.OpenForms["Form1"] as Form1) != null)
{
Application.OpenForms["Form1"].Close();
}
But my form has ShowInTaskBar = false
and my code does not work.
How can I detect opened or closed forms if the form has property ShowInTaskBar = false
?