Question about editing a DataGridView
I am using a DGV to display data from a table & allow the user to edit individual cells & then click a Save button to update the table. When the user clicks the Save button I show a Yes/No MessageBox that confirms the user really wants to write the edits. If they click Yes, the update is called & that part works fine. But if they click No, then I want all the cells that were edited to revert back to their original values. How can I achieve this? BTW, the DGV is bound to a DataTable.
Re: Question about editing a DataGridView
Call RejectChanges method of the datatable or datarow if the user click No. However, you must make sure that you call datatable.AcceptChanges before any editing occurs, and after updating data to the database.
Re: Question about editing a DataGridView
Thanks stanav ... that worked.