I working working with Visual Basic 2010 Express. I have a DataGridView that is linked up with a local SQL database I’ve created. I have it currently where the user can click a button to save their data to the db, but am unsure how to prompt them to save or discard changes if they are closing the program without saving.
Thanks!
Keep a global boolean (
Dim _bDocumentChanged as boolean) and when any DataGridView events are fired set your boolean toTrueand then on the Form_Closing() check that boolean and throw a message box.