DataRow.EndEdit Yöntem

Tanım

Satırda gerçekleşen düzenlemeyi sona erdirir.

public:
 void EndEdit();
public void EndEdit();
member this.EndEdit : unit -> unit
Public Sub EndEdit ()

Özel durumlar

yöntemi olayın içinde RowChanging çağrıldı.

Düzenleme bir kısıtlamayı bozdu.

Satır tabloya ait ve düzenleme salt okunur bir sütunun değerini değiştirmeye çalıştı.

Düzenleme, false olan AllowDBNull bir sütuna null değer yerleştirmeye çalıştı.

Örnekler

Aşağıdaki örnek, doğrulama işlevi true döndürürse değerin EndEdit düzenlenmesini sonlandırmak için yöntemini kullanırDataRow.

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

Açıklamalar

özelliğini ayarladığınızda, olayda RowChanging bir özel durum oluşursa bir özel durum oluşturulur.

Şunlara uygulanır

Ayrıca bkz.