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.RejectChanges

Rejects all changes made to the row since AcceptChanges was last called.

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

Exceptions

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

Remarks

When calling the RejectChanges method, the CancelEdit method is implicitly called to cancel any edits. If RowState is Deleted or Modified, the row reverts to its previous values, and RowState becomes Unchanged. If the RowState is New, the row is removed.

Example [Visual Basic]

The following example uses the IsNull method to check if a column is set to a null value. If so, the RejectChanges method is called.

[Visual Basic]

Private Sub IsValNull()
   Dim t As DataTable
   ' Assuming the DataGrid is bound to a DataTable.
   t = DataGrid1.DataSource

   Dim r As DataRow
   r = t.Rows(datagrid1.CurrentCell.RowNumber)
   r.BeginEdit
   r(1) = Null
   r.EndEdit
   If r.IsNull(1) Then 
      r.RejectChanges   
   r.AcceptChanges
   Else
      r.AcceptChanges
   End If
   End Sub

See Also

DataRow Class | DataRow Members | System.Data Namespace | AcceptChanges | IsNull