Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Interface and Graphics > MDI Form - Unload All Children

Thread Tools Display Modes
Old 04-01-2004, 08:17 AM
SiCo SiCo is offline
Join Date: Jul 2003
Posts: 16
Default MDI Form - Unload All Children

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.
Reply With Quote
Old 04-01-2004, 08:21 AM
Machaira's Avatar
Machaira Machaira is offline
Jedi Coder

* Expert *
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438

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
Reply With Quote
Old 04-01-2004, 09:46 AM
SiCo SiCo is offline
Join Date: Jul 2003
Posts: 16

Thanks for that works like a charm I think I now understand it also!
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB crash on form unload ms3343 General 3 03-29-2005 03:06 PM
Dumb Question: How to terminate (unload) a class module using a form? Sebastian Mares General 2 11-09-2002 04:33 PM
Problem with Property Let planet-boss General 9 06-12-2001 02:02 AM
Multiple Children in Master Detail Form susanl72 General 3 03-16-2001 11:22 AM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..