Link to home
Start Free TrialLog in
Avatar of danorme
danorme

asked on

Trying to Get MDIParent to run a sub after it see's NO MDIChild forms present(open)

I have a MDIParent which needs to be able to see when all the MDIChild Forms have been Closed so that I may run a sub process.  Any ideas.
Oh, I am pretty new at VB, so some code example may help.

Thanks.
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

What version VB?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if vb6

add this routine to module

Public Sub showlastformMsg()
   
    If Forms.Count = 2 Then
        MsgBox "last mdi child closed"
    End If
End Sub

add this on each mdi child

Private Sub Form_Unload(Cancel As Integer)
showlastformMsg
End Sub
may be you want to hide the form before

Private Sub Form_Unload(Cancel As Integer)
Me.Hide
showlastform
End Sub