Detecting open MDIForm child windows

How do you check to see if a child window is open already?
LVL 1
mkill22Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
WatsonRConnect With a Mentor Commented:
Oh... sorry. An example...

Assume you want to see if Form2 is loaded. From somewhere in your code, do this...

    if FormLoaded(Form2) then
      ' do this
    else
      ' do that
    end if
 
....and create a function like this.


Public Function FormLoaded(ByVal Target As VB.Form) As Boolean
    Dim Form As VB.Form
    For Each Form In Forms
        If Form Is Target Then
            FormLoaded = True
            Exit For
        End If
    Next Form
End Function
0
 
WatsonRCommented:
In the absence of a more subtle approach, enumerate through the Forms collection looking for the form in question ?

ie.

condition = false
For each frm in Forms
  if frm is blah then
    condition = true
    exit for
  end if
next frm

Ross
0
 
mkill22Author Commented:
Fine but what is blah? That is what I cannot work out.
0
All Courses

From novice to tech pro — start learning today.