jdy0803
Well-known member
How can I check if a Form is currently loaded or not?
Return My.Application.OpenForms.Cast(Of Form)().Any(Function(f) f.Name = sender)
Public Function IsFormOpen(Of TForm As Form)() As Boolean
Return My.Application.OpenForms.OfType(Of TForm)().Any()
End Function
If IsFormOpen(Of Form1)() Then
MessageBox.Show("A Form1 instance is open.")
Else
MessageBox.Show("There is no Form1 instance open.")
End If