User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 402,522 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,615 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 3293 | Replies: 6 | Solved
Reply
Join Date: Jul 2007
Posts: 174
Reputation: plusplus is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

How to check if form is open

  #1  
Aug 20th, 2007
How do I check if a form is open (not only loaded, but also open)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Posts: 174
Reputation: plusplus is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: How to check if form is open

  #2  
Aug 20th, 2007
Originally Posted by plusplus View Post
How do I check if a form is open (not only loaded, but also open)

What I mean is, I know how to check if it's loaded, but I want to know if it's being shown at this time
Reply With Quote  
Join Date: Nov 2006
Posts: 711
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 97
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: How to check if form is open

  #3  
Aug 20th, 2007
Hi,

Copy this Function and Pass the form name. If form is loaded and not shown, then it's Visible property will be false, u need to check that:

Private Sub CheckFormStatus(Myform As Form)
    Dim objForm As Form
    Dim FlgLoaded As Boolean
    Dim FlgShown As Boolean
    FlgLoaded = False
    FlgShown = False
    For Each objForm In VB.Forms
        If (Trim(objForm.name) = Trim(Myform.name)) Then
            FlgLoaded = True
            If objForm.Visible Then
                 FlgShown = True
            End If
            Exit For
        End If
    Next
    MsgBox "Load Status: " & FlgLoaded & vbCrLf & "Show Status:" & FlgShown
End Sub
 

Regards
Veena
Reply With Quote  
Join Date: Jul 2007
Posts: 174
Reputation: plusplus is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: How to check if form is open

  #4  
Aug 20th, 2007
Thank you , what you are saying is if it's loaded, check if its visible. Works perfectly. What is Trim in the code you gave me? I did it without, is there any reason it's needed?
Reply With Quote  
Join Date: Nov 2006
Posts: 711
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 97
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: How to check if form is open

  #5  
Aug 20th, 2007
Hi,

If it is for ur Timer Form..(previous thread), then I suggest an alternative solution. When u show the subForm in Modal, Disable the Timer, And Enable the timer In UnLoad event of the subForm. This way u need not check if the form is loaded/visible and all the stuff..

Regards
Veena
Reply With Quote  
Join Date: Nov 2006
Posts: 711
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 97
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: How to check if form is open

  #6  
Aug 20th, 2007
Hi,

Trim is not necessariy required, but just to be on the safer side, using Trim..

REgards
Veena
Reply With Quote  
Join Date: Jul 2007
Posts: 174
Reputation: plusplus is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: How to check if form is open

  #7  
Aug 20th, 2007
Thank you so much for that idea. My project is just getting bigger and bigger and every time I add another thing, I have to make sure it doesn't cause any problems to my old stuff. I'm at the end now and trying out every single possibility, to make sure it all works.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:44 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC