I have a simple WinForms GUI with multiple TextBoxes, CheckBoxes, and RadioButtons for the user to enter / modify data. Everything is loaded / saved from a SQL Server database. How do I warn the user when he wants to close the GUI? Do I query SQL to get data and compare it with what is in the GUI and if there are any differences I simply warn the user? Or is there a better way? Also it’s possible that during that time the user had a window open someone came in and changed something from another computer and the SQL Data would be different than what was orginally loaded into WinForms.
I have a simple WinForms GUI with multiple TextBox es, CheckBox es, and RadioButton
Share
Regarding local changes:
Keep a local flag that you set to true on any changes for a general message.
You could have a dictionary if you want to keep track of specific changes.
To prevent other users from overwriting the data, you could use locking, and prevent others from opening that record, or only allow them to open in read only.
You can use a time stamp on that record, and check if it has changed since you last read it, then warn the user that the data is no longer the same.