DataRow.EndEdit Método
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.
Finaliza a edição que ocorre na linha.
public:
void EndEdit();
public void EndEdit ();
member this.EndEdit : unit -> unit
Public Sub EndEdit ()
O método foi chamado dentro do evento RowChanging.
A edição violou uma restrição.
A linha pertence à tabela e a edição tentou alterar o valor de uma coluna somente leitura.
A edição tentou colocar um valor nulo em uma coluna em que AllowDBNull é false.
O exemplo a seguir usa o EndEdit método para encerrar a edição de um DataRow valor se a função de validação retornar true.
private void AcceptOrReject(DataRow row)
{
// Use a function to validate the row's values.
// If the function returns true, end the edit;
// otherwise cancel it.
if(ValidateRow(row))
row.EndEdit();
else
row.CancelEdit();
}
private bool ValidateRow(DataRow thisRow)
{
bool isValid = true;
// Insert code to validate the row values.
// Set the isValid variable.
return isValid;
}
Private Sub AcceptOrReject(ByVal row As DataRow)
' Use a function to validate the row's values.
' If the function returns true, end the edit;
' otherwise cancel it.
If ValidateRow(row) Then
row.EndEdit()
Else
row.CancelEdit()
End If
End Sub
Private Function ValidateRow(ByVal row As DataRow) As Boolean
Dim isValid As Boolean
' Insert code to validate the row values.
' Set the isValid variable.
ValidateRow = isValid
End Function
Quando você define a propriedade, uma exceção será gerada se uma exceção ocorrer no evento RowChanging.
Produto | Versões |
---|---|
.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 |
Comentários do .NET
O .NET é um projeto código aberto. Selecione um link para fornecer comentários: