Exiting - On Menustrip and Me.FormClosing

  • Thread starter Thread starter Rob W
  • Start date Start date
R

Rob W

Greetings,

I have an application which can be closed when clicking the "X" on the form
or selecting the "Exit" option from the menustrip.

However the code will run twice as my code handles the formclosing and the
click event of the menu option Exit.
I could use a boolean variable to stop this but Im sure there is a much
easier option, I just cant see it at this point.

How can I have my exit code (does current document needed saving or not)
execute only once when user click on the "X" OR chooses the exit option from
the menu?

Thanks
Rob
 
Sorted it, just added form.close to exit menu option and placed the bulk of
the code in the form closing event.
 
Back
Top