Yet another quick VB.NET question

Associate
Joined
6 Dec 2007
Posts
2,103
Hi yet again guys (you lot must be getting sick of me by now :D), I'd like a spot of help if ya'll be so kind.

Basically, my program has two ways of closing, 1.) File > Exit and 2.) Click the X.

These both bring up different message boxes asking the user if they want to save etc. Trouble is, the File > Exit way obviously closes the form, and the click X thingy handles the MyBase.FormClosing event. This means that when I do File > Exit, I also get the message box from the X as well. Any ideas as to how I can remedy this?

Will post code if required. TIA :)
 
Hi yet again guys (you lot must be getting sick of me by now :D), I'd like a spot of help if ya'll be so kind.

Basically, my program has two ways of closing, 1.) File > Exit and 2.) Click the X.

These both bring up different message boxes asking the user if they want to save etc. Trouble is, the File > Exit way obviously closes the form, and the click X thingy handles the MyBase.FormClosing event. This means that when I do File > Exit, I also get the message box from the X as well. Any ideas as to how I can remedy this?

Will post code if required. TIA :)

Do the dialogues need to be different? If not, just close the form from the File -> Exit handler and the FormClosing event will do the rest.

Otherwise, you'll probably need to set a flag or something to indicate that the form was closed via File -> Exit, and then close the form as above. Then have some code in the FormClosing event handler that checks the flag to see which dialogue it should display.
 
Back
Top Bottom