Please see this code which works if your forms are Form1 and Form2:
bool bForm1Open = false;
bool bForm2Open = false;
private void FormCheck()
{
bForm1Open = false;
bForm2Open = false;
foreach (Form form in Application.OpenForms)
{
if (form is Form1)
{
bForm1Open = true;
}
if (form is Form2)
{
bForm2Open = true;
}
}
}
private void ActionTime()
{
if (bForm1Open)
Debug.WriteLine("ThisOne is open");
if (bForm2Open)
Debug.WriteLine("The OtherOne is open");
}