To Check if a Form is open in C# and VB.NET you can use the snippet below.
Sample C#
public static bool FormIsOpen(FormCollection application, Type formType) { //usage sample: FormIsOpen(Application.OpenForms,typeof(Form2) return Application.OpenForms.Cast<Form>().Any(openForm => openForm.GetType() == formType); }
Sample VB.NET
Public Shared Function FormIsOpen(application__1 As FormCollection, formType As Type) As Boolean 'usage sample: FormIsOpen(Application.OpenForms,GetType(Form2) Return Application.OpenForms.Cast(Of Form)().Any(Function(openForm) openForm.[GetType]() = formType) End Function
How to check if a Form is Open in C# and #VB .NET http://t.co/JtyiDty4Ie #visualbasic #dotnet #csharp #visualstudio
RT @CodeSnippetsNET: How to check if a Form is Open in C# and #VB .NET http://t.co/JtyiDty4Ie #visualbasic #dotnet #csharp #visualstudio
RT @CodeSnippetsNET: How to check if a Form is Open in C# and #VB .NET http://t.co/JtyiDty4Ie #visualbasic #dotnet #csharp #visualstudio
RT @CodeSnippetsNET: How to check if a Form is Open in C# and #VB .NET http://t.co/JtyiDty4Ie #visualbasic #dotnet #csharp #visualstudio
How to check if a Form is Open in #csharp and #vbnet via @CodeSnippetsNET http://t.co/hhy3XsYUuj