DataGridView.Sorted 이벤트

정의

DataGridView 컨트롤이 정렬 작업을 완료하면 발생합니다.

public:
 event EventHandler ^ Sorted;
public event EventHandler Sorted;
public event EventHandler? Sorted;
member this.Sorted : EventHandler 
Public Custom Event Sorted As EventHandler 

이벤트 유형

예제

다음 코드 예제에서는 정렬 후 현재 셀이 표시되는지 확인하는 방법을 보여 줍니다. 이 코드는 언바운드 DataGridView 컨트롤에서만 작동합니다. 컨트롤이 DataGridView 외부 데이터 원본에 바인딩된 경우 정렬할 때 현재 셀이 자동으로 유지되지 않습니다.

이 예제를 실행하려면 다음 코드를 이름이 dataGridView1인 양식에 붙여넣습니다DataGridView. C#에서는 이벤트 처리기에 Sorted 도 이벤트를 연결해야 합니다.

private void dataGridView1_Sorted(object sender, EventArgs e)
{
    this.dataGridView1.FirstDisplayedCell = this.dataGridView1.CurrentCell;
}
Private Sub dataGridView1_Sorted(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles dataGridView1.Sorted

    Me.dataGridView1.FirstDisplayedCell = Me.dataGridView1.CurrentCell

End Sub

설명

이 이벤트는 속성이 VirtualMode 로 설정 true 되고 컨트롤이 바인딩되지 않은 열로 정렬될 때 발생하지 않습니다.

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

적용 대상

추가 정보