-
Save before close?
I've created a save function that checks to see if changes have been made when you select exit from the menu. My only problem is that I'm really new to VB and I'm not sure how to use this function with the toolbar close (X) as well. If anyone could help me out I'd appreciate it. Thanks for your time.
-
Call the Save function from the form's Closing event.
-
Since I'm a noob, how do I declare the closing event?
-
Code:
Private Sub form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
<your code here>
End Sub
That should do it
-
Don't worry you don't have to remember all that.
Go to the form designer, double click the form area and then when the code comes up, use the right-hand-side combobox to select the closing event, then the code in inserted for you.
-
Thankyou for your help. It's appreciated.