MDI Form - Unload All Children

04-01-2004, 08:17 AM
I am having a bit of trouble getting used to .NET MDI forms. In VB6 you used to be able to do this:

Dim frm As Form
For Each frm In Forms
If frm.Name <> mdiName Then
If frm.MDIChild = True Then
End If
End If
frm = Nothing

Which looped through all the open forms and shut them except the MDI form.

How do I replicate this in .NET, I can't get to grips with the Forms class and how to loop through it.

Thanks for your help.

04-01-2004, 08:21 AM
The Form class has a member called MdiChildren. Loop through it to close all the children:

Dim frm As Form

For Each frm In Me.MdiChildren
Next frm

04-01-2004, 09:46 AM
Thanks for that works like a charm I think I now understand it also!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum