We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to close multiple MDI child forms with TabbedMDIManager

Thread ID:

Created:

Updated:

Platform:

Replies:

59350 Apr 11,2007 10:59 AM Apr 19,2007 06:25 AM Windows Forms 2
loading
Tags: Tools
James Sandys-Lumsdaine
Asked On April 11, 2007 10:59 AM

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.

James Sandys-Lumsdaine
Replied On April 12, 2007 04:08 AM

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

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

Poly J [Syncfusion]
Replied On April 19, 2007 06:25 AM

Hi Jas,

Thanks for the update.

Regards.
Poly

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;