Leer en inglés

Compartir vía


DataView.Delete(Int32) Método

Definición

Elimina una fila en el índice especificado.

C#
public void Delete (int index);

Parámetros

index
Int32

Índice de la fila que se va a eliminar.

Ejemplos

En el ejemplo siguiente se usa el Delete método para eliminar una fila.

VB
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
    Else
        view.Delete(i)
    End If
End Sub

Comentarios

Después de eliminar un DataRow, su estado cambia a DataViewRowState.Deleted. Puede revertir la eliminación llamando a RejectChanges en .DataTable

Se aplica a

Producto Versiones
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Consulte también