Results 1 to 7 of 7

Thread: Checking if a form is active?

  1. #1

    Thread Starter
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203

    Question Checking if a form is active?

    How can I check to see if a form is active?

  2. #2
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    what do you mean by "Active"..Visible?
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  3. #3

    Thread Starter
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203
    yes, I mean visible

  4. #4
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382
    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

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    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
    something like this :
    VB Code:
    1. Dim frm2 As New Form2()
    2. If frm2.Visible = True Then
    3. MsgBox("Form 2 is Visible")
    4. Else
    5. MsgBox("Form 2 is not Visible")
    6. End If

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    huh , too late .Hinder solved it !

  7. #7

    Thread Starter
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203
    This is what is in my program right now:
    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
    When the filesystemwatcher is invoked more than one time I still end up with a bunch of forms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width