DataView.Delete(Int32) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Exclui uma linha no índice especificado.
public:
void Delete(int index);
public void Delete (int index);
member this.Delete : int -> unit
Public Sub Delete (index As Integer)
Parâmetros
- index
- Int32
O índice da linha a ser excluída.
Exemplos
O exemplo a seguir usa o Delete método para excluir uma linha.
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
Comentários
Depois de excluir um DataRow, seu estado muda para DataViewRowState.Deleted. Você pode reverter a exclusão chamando RejectChanges no DataTable.