How to add code to the default close/exit button on a form?
-
The default close/exit button on my form instantly closes the form when clicked. However I would like the form to ask if I would like to save changes before closing when clicking this button. I can't work out how to get access to the relevant function - assuming that is what i need to do. How should I go about solving this problem? Thanks
Haz
-
The default close/exit button on my form instantly closes the form when clicked. However I would like the form to ask if I would like to save changes before closing when clicking this button. I can't work out how to get access to the relevant function - assuming that is what i need to do. How should I go about solving this problem? Thanks
Haz
Register to the
Form.Closing
event and use the passedCancelEventArgs
object to cancel the closing process if needed.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook