DataGridView.RowValidated 事件

定義

資料列完成驗證後發生。

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

事件類型

範例

下列程式碼範例會使用此事件清除驗證資料列之後可能留下的任何錯誤批註。

private void RemoveAnnotations(Object sender, 
    DataGridViewCellEventArgs args) 
{
    foreach (DataGridViewCell cell in 
        songsDataGridView.Rows[args.RowIndex].Cells)
    {
        cell.ErrorText = String.Empty;
    }

    foreach (DataGridViewRow row in songsDataGridView.Rows)
    {
        row.ErrorText = String.Empty;
    }
}
Private Sub RemoveAnnotations(ByVal sender As Object, _
    ByVal args As DataGridViewCellEventArgs) _
    Handles songsDataGridView.RowValidated

    For Each cell As DataGridViewCell In _
        songsDataGridView.Rows(args.RowIndex).Cells
        cell.ErrorText = String.Empty
    Next

    For Each row As DataGridViewRow In songsDataGridView.Rows
        row.ErrorText = String.Empty
    Next

End Sub

備註

此事件類似于 Validated 事件。 使用此事件對值列執行後處理。

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

適用於

另請參閱