DataView.Delete Method (Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Deletes a row at the specified index.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public void Delete(
	int index


Type: System.Int32

The index of the row to delete.

After deleting a DataRow, its state changes to DataViewRowState.Deleted. You can roll back the deletion by calling RejectChanges on the DataTable.

The following example uses the Delete method to delete a row.

Private Sub DeleteRow(view As DataView, val As String)
    ' Find the given value in the DataView and delete the row.
    Dim i As Integer = view.Find(val)

    If i = -1 Then
        ' The value wasn'table found
        Console.WriteLine("Value not found in primary key column")
        Exit Sub
    End If
End Sub

.NET Framework
Available since 1.1
Return to top