DataGridView.RowValidated 事件

定义

行完成验证时发生。Occurs after a row has finished validating.

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 

示例

下面的代码示例使用此事件来清除在验证行后可能已遗留的任何错误批注。The following code sample uses this event to clear up any error annotations that may have been left behind after validating the row.

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

注解

此事件与 @no__t 0 事件类似。This event is analogous to the Validated event. 使用此事件可以对值的行执行后续处理。Use this event to perform post-processing on a row of values.

有关如何处理事件的详细信息,请参阅处理和引发事件For more information about how to handle events, see Handling and Raising Events.

适用于

另请参阅