I think, I have understood your requirement. Well, you can try the following.
1. On you form, have a property: bool dirtyFlag. By default it's value is false.
2. When the gird load's, set dirtyFlag = false;
3. With every modifications done in the datagrid values, set dirtyFlag = true; in the appropriate events of datagrid.
4. When ever the user saves the changes made to datagrid, set dirtyFlag = false;
5. Now, add the condition - if(dirtyFlag == true) during Form closing. This condition checks if the datagrid modifications have been saved or not.
if(dirtyFlag == true)
{
...Changes haveNOT been saved...
}
else
{
...Changes have been saved...
}
Regards,
Lakra :)
- If the post is helpful or answers your question, please mark it as such.