How to close multiple MDI child forms with TabbedMDIManager

Hi,

I'm using the TabbedMDIManager and I want to have a "Close All" menu option in my Window menu - I've tried several methods to close all windows, starting with closing each Form in the rootForm.MdiChildren collection but this causes a null pointer exception.

If I was using a normal MDI form I would get rootForm.OwnedForms - but this collection is empty. Could you advise or point to an example to do this?

I'll also be adding a "Close All But This" - which leaves the active child form.

Thanks,

Jas.

2 Replies

JS James Sandys-Lumsdaine April 12, 2007 08:08 AM UTC

I think I stumbled on the answer - use the tabbedMDIManager.MDIChildren property:

foreach (Form form in tabbedMDIManager.MdiChildren)
{
if (ActiveMdiChild != form)
form.Close();
}


PJ Poly J Syncfusion Team April 19, 2007 10:25 AM UTC

Hi Jas,

Thanks for the update.

Regards.
Poly

Loader.
Up arrow icon