How do you tell if an mdi child is open

How can you tell what mdi child windows are loaded  

Answer this question

How do you tell if an mdi child is open

  • Esquif

    more info... in vb.net windows application (yep - I'm new at this :-) )
  • Andrew34Fisher

    If you simply need a visual check (you didn't state whether you wanted to determine if a form was open visually, or programmatically) by setting the MdiList property of a menu item--this causes the form to display a list of open child windows, with the current one "checked" in the list.

    You can tell if there are <b>any</b> MDI children open by comparing the length of the MdiChildren collection property to 0, as shown earlier. If you want to determine which windows are loaded, you can write code something like this:
        Dim frm As Form
        For Each frm In Me.MdiChildren
          Debug.WriteLine(frm.Name)
        Next
    If you want to determine if a particular child form is loaded, you can use code something like this (which determines if an instance of the Form3 class is currently loaded):
        Dim frm As Form
        For Each frm In Me.MdiChildren
          If TypeOf frm Is Form3 Then
            Debug.WriteLine("Found a form3")
          End If
        Next

  • RafaMiranda

    .MdiChildren.Length == 0, then there's no child
  • ks2006

    Erymuzuan and Ken, thankyou very much, I knew it would be simple :-)
  • Tony Steele

    Thanks of the help Ken. I am a newbie myself and I was wondering how to achieve this for a little while now.
  • How do you tell if an mdi child is open