Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a datatabe which i bind to my Form So it also bind to the Control of the form
and for now can i Know if the datatable is Edited by the user (within the control of the Form) ..?
any one can help me please ..?

thanks in advanced
Posted
Comments
Sergey Alexandrovich Kryukov 10-Oct-11 19:39pm    
Do you mean edited in the same process? It depends how you do it.
--SA

1 solution

You can use DataTable.GetChanges[^] and check if it returns null or not.
Or you can loop over the rows in the DataTable and check the DataRow.RowState[^] property, with linq it would look something like this
C#
bool hasChanges = myDataTable.Rows.Cast<DataRow>()
                             .Any(r => r.RowState != DataRowState.Unchanged);
 
Share this answer
 
v2
Comments
Espen Harlinn 13-Oct-11 17:25pm    
5'ed!
Simon Bang Terkildsen 14-Oct-11 6:00am    
Thank you, Espen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900