You do not say which version of C# or .NET you are using. Also, you do not say if you are using WPF or not.
In .NET Framework 2.0 and later, in the
System.Windows.Forms
namespace, there is the
OpenForms
property which returns a
FormsCollection
.
You can also use
Application.OpenForms
. For example:
foreach (Form form in Application.OpenForms)
{
}