Deletes a row at the specified index.
[Visual Basic] Public Sub Delete( _ ByVal index As Integer _ ) [C#] public void Delete( int index ); [C++] public: void Delete( int index ); [JScript] public function Delete( index : int );
After deleting a DataRow, its state changes to DataViewRowState.Deleted. You can roll back the deletion by calling RejectChanges on the DataTable.
[Visual Basic] The following example uses the Delete method to delete a row.
[Visual Basic]
Private Sub DeleteRow(dv As DataView, val As String)
' Find the given value in the DataView and delete the row.
Dim i As Integer
i = dv.Find(val)
If i = -1 Then
' The value wasn't found
MessageBox.Show("Value not found in primary key column")
Exit Sub
Else
dv.Delete(i)
End If
End Sub
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET
DataView Class | DataView Members | System.Data Namespace | DataViewRowState | Find