How to close all open MDI children without closing the Parent

newbjohny

Member
Joined
Jul 10, 2006
Messages
11
Programming Experience
Beginner
Hi, I am creating a GUI to a database, I would like to know when I click a button to open a new database, all open MDI children relating to the old database that are open are closed without closing the parent form.

I stored the name of the parent form into a module and tried this, but it only closes one, if there are more than one it does not work.

ParentName.mdif.ActiveMdiChild.Close()

Any suggestions are greatfully appreciated.

John
 
I managed to get it done, I pasted the code underneath incase someone else has a similar problem.

John

Dim form As System.Windows.Forms.Form
For Each form In Me.MdiChildren
form.Close()
Next form
 
Back
Top