Question Change value in a datagridview row if data is change in same row

DaveTichenor

New member
Joined
Sep 2, 2016
Messages
2
Programming Experience
10+
Please Note: when the datagridview is loaded - data in every row of the datagridview is change (due to decrypt of an encrypted data field).

So how do I determine which rows are change after the data load event has made its initial load which included these changes.

I need to change the "update date" on a row that changes after the data load event has completed.

I am using Visual Studio 2015

Thanks
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,147
Location
Sydney, Australia
Programming Experience
10+
It's the RowState property of a DataRow that is used to track changes. The values of interest are Unchanged, Added, Modified and Deleted. When you first add a row to a DataTable, the RowState is set to Added. That is the case when you first populate a DataTable with a DataAdapter too. When you call Fill, all the rows that get added have a RowState of Added until, as a final step, it calls AcceptChanges to reset all the RowStates to Unchanged. You can override that default behaviour by setting AcceptChangesOnFill to False.

In your case, you can do basically the same thing. You call Fill to populate your DataTable, perform all the decryption and then call AcceptChanges. That will reset all the RowStates to Unchanged so you will then be able to track changes from that point.
 
Top Bottom