Exiting - On Menustrip and Me.FormClosing

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
 
R

Rob W

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top