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 423,535 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 4,349 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: 1117 | Replies: 2
Reply
Join Date: Jul 2007
Posts: 175
Reputation: plusplus is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

check if form is open

  #1  
Dec 24th, 2007
At runtime I want to check if a certain form is open. I know how to check if a form is open.
I do it like this(where form1 and form2 contain the names of the form)

For Each fForm In Forms
    
            If fForm.Name = Form1 Or fForm.Name = form2 Then
                
                proramm_running = True
                Exit Sub
            
            End If
            
 Next


My problem is I want to check if any copy of these forms are open and those would have different names?
Last edited by plusplus : Dec 24th, 2007 at 2:19 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2005
Location: Phnom Penh, Cambodia
Posts: 410
Reputation: invisal will become famous soon enough invisal will become famous soon enough 
Rep Power: 5
Solved Threads: 36
invisal's Avatar
invisal invisal is offline Offline
Posting Pro in Training

Re: check if form is open

  #2  
Dec 24th, 2007
I am not sure because I haven't program in VB6 for so long. I think Form.Visible would be the answer because if Form.Visible = false which mean the form doesn't not appear in the screen.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Reply With Quote  
Join Date: Nov 2007
Posts: 115
Reputation: hkdani is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
hkdani's Avatar
hkdani hkdani is offline Offline
Junior Poster

Re: check if form is open

  #3  
Dec 25th, 2007
My problem is I want to check if any copy of these forms are open and those would have different names?

There are several collection objects that you can reference in your project in Visual Object: one is the forms collection.

Use the For Each with the Forms collection to cycle through the forms.

Try this in a sub routine.

Dim frm as form
For each frm in Forms
  debug.print frm.Name
next

I just accessed one property here. But you extract whatever property you would like during the For Each loop.

Hank
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 5:29 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC