how to control the close button in control bar on the form

  • Thread starter Thread starter pei_world
  • Start date Start date
P

pei_world

1.when the user click the close button on the top right of the form, I would
like to pop up a message box ask for answer, if user click no, then ignore
the action, otherwise exit the app.

2.trying to do something like, click on the close button, the app still run,
and only display the noticfyicon in tary bar.


thanks
 
Hi,

You will have to use the Closing event of the form, (not override it). In
the event handler do what you have to do and ask what you have to ask and if
you decide to abort the closing of the form just set the e.Cancel = True;
where e is the CancelEventArgs parameter in your event handler.

Hope that helps
Cata
 
Back
Top