I posted a question last week: "Detect Data change in datagrid". I may be so green at VB.net that I may not have even asked my question correctly and plain enough that someone could propose a solution, so here goes again:

I am creating a Windows Form and I need to have a way of knowing when the data has changed in my datagrid control. I want to be able to interact with the user when they attempt to close the form but have un-saved changes to the current data.

I've been looking all over the place for a solution, but have not found something that I could understand enought to try to implement. It seems that there is no easy way to detect the data changes.

Any assistance is appreciated.

Hi Try,

Dim SQLChanges as New DataTable

SQLChanges = SQLTable.GetChanges

if SQLChanges.Rows.Count > 0 then
   msgbox("Changes Detected!")
   Exit Sub
End if

SQLChanges is a New Datatable
SQLTable is your current datatable

Or if you are using a Dataset then

if Dataset.HasChanges = True then
   msgbox("Changes Detected!")
   Exit Sub
End if

Just what I was looking for.

Thank you so much.