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 事件。 使用此事件对一行值执行后期处理。

有关如何处理事件的详细信息,请参阅 处理和引发事件

适用于

另请参阅