0

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.

2
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by Byron P
0

Hi Try,

Dim SQLChanges as New DataTable

SQLChanges = SQLTable.GetChanges

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

Where
SQLChanges is a New Datatable
and
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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.