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?

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.