G
Guest
Hi
Ok here goes I have an MDI application and when a user clicks on the close button on the form "the X" , I would like to disable menus if there are no more MDI Chid forms. So I decided to raise an event from the MDI Child form to the parent, allowing the parent to disable menus if it has no more MDI Child Forms. This works fine if I only create one child form but when there are anymore then that the count shows that there is one more then should be untill the GC comes to get it
I have tried raising this event from the closing, closed and disposed events of the Child form
Does anybody have any idea how I can force an accurate count of MDI Child forms
Here is the code
Dim frm As For
Dim Count As Intege
For Each frm In Me.MdiChildre
Count = Count +
Nex
If Not mnuReportClose.Enabled = True The
mnuReportClose.Enabled = Tru
End I
If Not mnuWindow.Enabled = True The
mnuWindow.Enabled = Tru
End I
If Count < 1 The
mnuReportClose.Enabled = Fals
mnuWindow.Enabled = Fals
End I
Thanks
Ok here goes I have an MDI application and when a user clicks on the close button on the form "the X" , I would like to disable menus if there are no more MDI Chid forms. So I decided to raise an event from the MDI Child form to the parent, allowing the parent to disable menus if it has no more MDI Child Forms. This works fine if I only create one child form but when there are anymore then that the count shows that there is one more then should be untill the GC comes to get it
I have tried raising this event from the closing, closed and disposed events of the Child form
Does anybody have any idea how I can force an accurate count of MDI Child forms
Here is the code
Dim frm As For
Dim Count As Intege
For Each frm In Me.MdiChildre
Count = Count +
Nex
If Not mnuReportClose.Enabled = True The
mnuReportClose.Enabled = Tru
End I
If Not mnuWindow.Enabled = True The
mnuWindow.Enabled = Tru
End I
If Count < 1 The
mnuReportClose.Enabled = Fals
mnuWindow.Enabled = Fals
End I
Thanks