Deletes the row.
[Visual Basic] Public Sub Delete() [C#] public void Delete(); [C++] public: void Delete(); [JScript] public function Delete();
Exception Type | Condition |
---|---|
RowNotInTableException | The row doesn't belong to the table. |
DeletedRowInaccessibleException | The row has already been deleted. |
If the RowState of the row is New, the row will be removed from the table.
The DataViewRowState becomes Deleted after using the Delete method.
The following example deletes the row in a System.WinForms.DataGrid control with the focus.
[Visual Basic]
Private Sub DeleteRow() Dim t As DataTable t = DataSet1.Tables(0) Dim row As DataRow row = t.Rows(DataGrid1.CurrentCell.RowNumber) row.Delete End Sub