how to cancel a form to closing

  • Thread starter Thread starter pei_world
  • Start date Start date
catch the close event. a good place to put it is in the constructor.

this.Closing+=new CancelEventHandler(SolutionExplorer_Closing);

and the handling method example here is self evident, it cancels the close
and hides the form. You can call .Show() to restore it.
private void SolutionExplorer_Closing(object sender, CancelEventArgs args)

{

args.Cancel = true;

this.Hide();

}
 
Back
Top