0

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?

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by hkdani
0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.