Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1635
How to dispose MdiChildForm in DockManager
posted

I'd like to dispose the MdiChildForm in DockManger, when I close the tab.

I tried to dispose the DockableControlPane at TabClosing event handler, but it the MdiChildForm is not diposed completely.

So, the MdiChildForm is still working in the background.

Is there any way to dispose the MdilChildForm completely?

This is the code that I tried.

private void ultraTabbedMdiManager1_TabClosing( object sender, CancelableMdiTabEventArgs e )
{
 MdiChildForm form = e.Tab.Form as MdiChildForm;

 if ( form != null )
 {
  DockableControlPane pane = form.Pane;

  pane.IsMdiChild = false;

  if ( pane.Control != null )
   pane.Control.Dispose(); //removes from DockManager collections

  pane.Dispose();

  e.Cancel = true;
 }
}