NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataRow.AcceptChanges

Commits all the changes made to this row since the last time AcceptChanges was called.

[Visual Basic]
Public Sub AcceptChanges()
[C#]
public void AcceptChanges();
[C++]
public: void AcceptChanges();
[JScript]
public function AcceptChanges();

Exceptions

Exception Type Condition
RowNotInTableException The row doesn't belong to the table.

Remarks

When invoking AcceptChanges, the EndEdit method is implicitly called to end any edits. If the RowState of the row was New or Modified, the RowState becomes Unchanged. If the RowState was Deleted, the row is removed.

See the BeginEdit method for more details.

The DataTable class also has an AcceptChanges method which affects changes made to the entire table.

Example [Visual Basic]

The following example edits the value of one column in the last row of a System.WinForms.DataGrid control. The example uses the BeginEdit, EndEdit, and AcceptChanges methods to programmatically edit the column's value and commit the change to the row, and finally to the table itself.

[Visual Basic]

Private Sub EditAndAccept()
   Dim t As DataTable
   t = DataGrid1.DataSource.DataTable
   
   Dim myrow As DataRow
   myRow = t.Rows(t.Rows.Count - 1)
    
   myrow.BeginEdit
   myrow(1) = Edit1.Text
    
   myrow.EndEdit
   myrow.AcceptChanges
   t.AcceptChanges 
End Sub

See Also

DataRow Class | DataRow Members | System.Data Namespace | AcceptChanges | BeginEdit | CancelEdit | DataViewRowState | DataTable | EndEdit | HasVersion | Item | RowState