DataGridView.CellValidated 事件

定義

儲存格完成驗證之後發生。

public:
 event System::Windows::Forms::DataGridViewCellEventHandler ^ CellValidated;
public event System.Windows.Forms.DataGridViewCellEventHandler CellValidated;
public event System.Windows.Forms.DataGridViewCellEventHandler? CellValidated;
member this.CellValidated : System.Windows.Forms.DataGridViewCellEventHandler 
Public Custom Event CellValidated As DataGridViewCellEventHandler 

事件類型

範例

下列程式碼範例示範如何使用 CellValidated 事件來清除 ErrorText 屬性。 在此範例中,如果使用者在資料格中輸入不正確資料,事件 CellValidating 就會設定 ErrorText 。 此範例是 事件中較大範例的 SelectionChanged 一部分。

private void DataGridView1_CellValidated(object sender,
    DataGridViewCellEventArgs e)
{
    // Clear any error messages that may have been set in cell validation.
    DataGridView1.Rows[e.RowIndex].ErrorText = null;
}
Private Sub CellValidated(ByVal sender As Object, _
    ByVal e As DataGridViewCellEventArgs) _
    Handles DataGridView1.CellValidated

    ' Clear any error messages that may have been set in cell validation.
    DataGridView1.Rows(e.RowIndex).ErrorText = Nothing
End Sub

備註

處理此事件適用于資料格值的驗證後處理。

如需如何處理事件的詳細資訊,請參閱 處理和引發事件

適用於

另請參閱