Hi Jim,
You should check for the specific tabGroup and handle the mdiTabPanel to close all the forms in the tabGroup. Please refer to the coding snippet below.
// Handle child form''s closing event
child.Closing +=new CancelEventHandler(this.MdiChildFormClosed);
private void MdiChildFormClosed (object sender, CancelEventArgs arg)
{
if (flag == 0)
{
Form2 form = sender as Form2;
// check for the TabGroup in which it is present
foreach(TabPageAdv page in this.tabbedMDIManager.GetTabHostFromForm(form).MDITabPanel.TabPages)
{
// the tabpage''s Tag stores the MDI form associated with it
Form2 temp = page.Tag as Form2;
if (form == temp)
{
flag = 1;
this.CloseAllForms(this.tabbedMDIManager.GetTabHostFromForm(form).MDITabPanel);
break;
}
}
}
flag = 0;
}
private void CloseAllForms(MDITabPanel mdiTabpanel)
{
foreach(TabPageAdv page in mdiTabpanel.TabPages)
{
((Form2)page.Tag).Close();
}
}
Please refer to the sample attached below that illustrated this completely and let me know if you have any questions.
Regards,
Mano
CloseAllTabs.zip