怎样遍历Mdi窗体中的子窗体?谢谢指教。

解决方案 »

  1.   

    Private Function isOpen(ByVal FormName As String) As Boolean
            isOpen = False
            Dim i As Int16
            Dim Fm() As Form = Me.MdiChildren
            For i = 0 To UBound(Fm)
                If UCase(Fm(i).Name) = UCase(FormName) Then
                    Fm(i).BringToFront()
                    isOpen = True
                    Exit For
                End If
            Next
        End Function
      

  2.   

    foreach( Form child in this.MdiChildren )
    {}
      

  3.   

    //一下功能检测指定的窗体是否已经创建,如果没有就创建BillInput是一个mdi子窗体                           
    BillInput input=null;
    foreach(Form f in this.MdiChildren)
    {
    if(f is BillInput)
    {
    input=(BillInput)f;
    break;
    }
    }
    if(input!=null)
    {
    input.Show();
    input.Focus();
    }
    else
    {
    input=new BillInput();
    input.MdiParent=this;
    input.WindowState=FormWindowState.Maximized;
    input.Show();
    input.Update();
    }