多文档下,如何关闭所有子窗体?

解决方案 »

  1.   

    Private Sub MDIForm_Unload(Cancel As Integer)
        Dim f As Form
        'InsertLog "退出系统", " "
        For Each f In Forms
            If Not f Is MDIfrmMain Then Unload f
        Next
        If Forms.Count > 1 Then
            Cancel = 1
            Exit Sub
        End If
        End Sub
      

  2.   

    Private Sub MDIForm_Unload(Cancel As Integer)
        Dim f As object    
        For Each f In Forms
            If typeof  f Is form Then 
               Unload f
               set f=nothing
            end if
        Next
        End Sub