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
945
TabClosing event
posted

We are using TabControl instead of TabbedMdiManager now, and TabControl is embedded inside a custom Control (instead of a Form).

There are some problem with the TabClosing event.
It is fine when i close an individual tab, and this event is fired by the TabCotnrol.
However, when i tried to close Form (which has the custom control), the TabClosing event is not called on each individual tab.

Compared to the TabbedMdiManager, when a Form's OnClosing event is fired, MdiTab.OnMdiChildClosing is fired, and Closing event on each tab is fired. I can write my own event handler for closing each tab.

How can I achieve this when using TabControl?
What is the equivelant of Closing event on a Control instead of a Form? 

Thanks.

  • 44743
    posted

    This is correct behavior. The TabClosing event is only fired on a tab when the tab is closed. When the Form is closed, the tabs are not individually closed. Mdi parent forms had extra code to hide their children before they closed and that is why you were able to use this approach with the UltraTabbedMdiManager. You can get the same effect by manually closing or verifying each tab in the Form's FormClosing event. If any tab is not verified, you can cancel the event.