Hi Mark,
Follow the steps below for this purpose :
1. Handle the Closing event for each of the child forms
2. Get the TabHost associated with that MDI child form
3. Get the associated MDITabPanel from the TabHost
4. Each of the TabPageAdvs in the MDITabPanel contain the respective MDI child form within their Tag object. Access the MDI child form associated with each MDI child form''s Tag and close it.
Refer to the code below which shows how this can be done :
private void MdiChildFormClosed (object sender, CancelEventArgs arg)
{
// to ensure that the child form
// closing event does not get called recursively
if (flag==0)
{
// get the MDI child form closed
Form2 form = sender as Form2;
// check for the TabGroup in which it is present
foreach(TabPageAdv page in this.tabbedGroupedMdiManager.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.tabbedGroupedMdiManager.GetTabHostFromForm(form).MDITabPanel);
break;
}
}
}
}
private void CloseAllForms(MDITabPanel mdiTabpanel)
{
foreach(TabPageAdv page in mdiTabpanel.TabPages)
{
((Form2)page.Tag).Close();
}
}
The
complete sample illustrating this is attached here. Thanks for considering Syncfusion products.
Regards,
Guru Patwal
Syncfusion, Inc.