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

Cancels the current edit on the row.

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

Exceptions

Exception Type Condition
InRowChangingEventException The method was called inside the RowChanging event.

Remarks

See the BeginEdit method for more details.

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 = DataSet1.Tables(0)
   
   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 | DataViewRowState | EndEdit | HasVersion | Item | RowState