How can I check to see if a form is active?
Printable View
How can I check to see if a form is active?
what do you mean by "Active"..Visible?
yes, I mean visible
If you want to see if a form is visible, just check the visible flag :)
If Form1.Visible Then Do Whatever
if you want to see if the form is loaded just do a..
If Not Form1 Is Nothing Then Do Whatever
something like this :Quote:
Originally posted by Hinder
If you want to see if a form is visible, just check the visible flag :)
If Form1.Visible Then Do Whatever
if you want to see if the form is loaded just do a..
If Not Form1 Is Nothing Then Do Whatever
VB Code:
Dim frm2 As New Form2() If frm2.Visible = True Then MsgBox("Form 2 is Visible") Else MsgBox("Form 2 is not Visible") End If
huh , too late:D .Hinder solved it !
This is what is in my program right now:
When the filesystemwatcher is invoked more than one time I still end up with a bunch of forms.Code:Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed
Dim frm1 As New Form1()
If frm1.Visible = False Then
frm1.Visible = True
End If
End Sub