DataGridView.RowDirtyStateNeeded 이벤트

정의

VirtualMode 컨트롤의 DataGridView 속성이 true이고 DataGridView가 현재 행에 커밋되지 않은 변경 내용이 있는지 여부를 확인해야 하는 경우 발생합니다.

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

이벤트 유형

예제

다음 코드 예제에서는 이 이벤트를 처리하여 셀 수준 커밋 scope 제공하는 방법을 보여 줍니다. 즉, 사용자가 현재 셀에만 변경 내용을 되돌리기 수 있습니다. 셀 수준 커밋 scope 행의 셀에 커밋되지 않은 변경 내용이 있는 경우 대신 현재 셀에 커밋되지 않은 변경 내용이 있는 경우에만 행이 커밋되지 않은 변경 내용으로 처리됩니다. 이 예제는 연습: Windows Forms DataGridView 컨트롤에서 가상 모드 구현에서 사용할 수 있는 더 큰 예제의 일부입니다.

void dataGridView1_RowDirtyStateNeeded( Object^ /*sender*/,
    System::Windows::Forms::QuestionEventArgs^ e )
{
   if (  !rowScopeCommit )
   {
      
      // In cell-level commit scope, indicate whether the value
      // of the current cell has been modified.
      e->Response = this->dataGridView1->IsCurrentCellDirty;
   }
}
private void dataGridView1_RowDirtyStateNeeded(object sender,
    System.Windows.Forms.QuestionEventArgs e)
{
    if (!rowScopeCommit)
    {
        // In cell-level commit scope, indicate whether the value
        // of the current cell has been modified.
        e.Response = this.dataGridView1.IsCurrentCellDirty;
    }
}
Private Sub dataGridView1_RowDirtyStateNeeded(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.QuestionEventArgs) _
    Handles dataGridView1.RowDirtyStateNeeded

    If Not rowScopeCommit Then

        ' In cell-level commit scope, indicate whether the value
        ' of the current cell has been modified.
        e.Response = Me.dataGridView1.IsCurrentCellDirty

    End If

End Sub

설명

기본적으로 이 이벤트는 현재 행의 셀이 QuestionEventArgs.Response 수정된 경우 속성을 true 로 설정합니다. 이렇게 하면 CancelRowEdit 사용자가 편집을 행으로 되돌릴 때 이벤트가 발생합니다. 사용자는 셀이 편집 모드에 있거나 편집 모드 외부에 있을 때 ESC를 두 번 눌러 행에 대한 편집을 되돌리기 수 있습니다. 이 이벤트는 선택한 커밋 scope 따라 속성을 올바른 값으로 설정 QuestionEventArgs.Response 하여 가상 모드에서 커밋 scope 사용자 지정하는 데 사용할 수 있습니다.

이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

적용 대상

추가 정보