Hi guys,
I have a form with a few text fields in it. What I want to do is have a msg box pop up if the user leaves the form and the form is dirty. The msg box would then give the user the opportunity to save the changes or cancel before moving to the next form.
What I've done that works, is place the code into the click events of all of the buttons on the form. This gets the job done but it also needlessly duplicates code. I then tried to do the same thing with a form_close event and the form just closes and saves the changes without prompting the user first.
Are there any form events that will allow me to do what I would like to do or will i just have to place all of the code into a function and then place a call to that function in each buttons' click events?
Thanks.
I have a form with a few text fields in it. What I want to do is have a msg box pop up if the user leaves the form and the form is dirty. The msg box would then give the user the opportunity to save the changes or cancel before moving to the next form.
What I've done that works, is place the code into the click events of all of the buttons on the form. This gets the job done but it also needlessly duplicates code. I then tried to do the same thing with a form_close event and the form just closes and saves the changes without prompting the user first.
Are there any form events that will allow me to do what I would like to do or will i just have to place all of the code into a function and then place a call to that function in each buttons' click events?
Thanks.