void Page_Closing(object sender, CancelEventArgs e) { TabPage page = sender as TabPage; if (PageClosing != null && page != null) { PageCloseEventArgs evt = new PageCloseEventArgs(page, e.Cancel); PageClosing(this, evt); e.Cancel = evt.Cancel; } }