다음을 통해 공유


DataView.ListChanged 이벤트

정의

DataView 에서 관리하는 목록이 변경되면 발생합니다.

public:
 virtual event System::ComponentModel::ListChangedEventHandler ^ ListChanged;
public event System.ComponentModel.ListChangedEventHandler? ListChanged;
public event System.ComponentModel.ListChangedEventHandler ListChanged;
[System.Data.DataSysDescription("DataViewListChangedDescr")]
public event System.ComponentModel.ListChangedEventHandler ListChanged;
member this.ListChanged : System.ComponentModel.ListChangedEventHandler 
[<System.Data.DataSysDescription("DataViewListChangedDescr")>]
member this.ListChanged : System.ComponentModel.ListChangedEventHandler 
Public Custom Event ListChanged As ListChangedEventHandler 

이벤트 유형

구현

특성

예제

다음 예제에서는 의 이벤트에 대한 ListChanged 처리기를 추가합니다 DataView.

public void CreateDataView(DataTable table)
{
    DataView view = new DataView(table, "",
        "ContactName", DataViewRowState.CurrentRows);

    view.ListChanged  += new
        System.ComponentModel.ListChangedEventHandler(
        OnListChanged);
}

private void OnListChanged(object sender,
    System.ComponentModel.ListChangedEventArgs args)
{
    Console.WriteLine("ListChanged:");
    Console.WriteLine("\table    Type = " + args.ListChangedType);
    Console.WriteLine("\tOldIndex = " + args.OldIndex);
    Console.WriteLine("\tNewIndex = " + args.NewIndex);
}
Public Sub CreateDataView(table As DataTable) 
    Dim view As New DataView(table, "", _
        "ContactName", DataViewRowState.CurrentRows)

    AddHandler view.ListChanged, _
        New System.ComponentModel.ListChangedEventHandler( _
        AddressOf OnListChanged)
End Sub

Private Sub OnListChanged(sender as Object, _
    args As System.ComponentModel.ListChangedEventArgs)

    Console.WriteLine("ListChanged:")
    Console.WriteLine(vbTab & "    Type = " & args.ListChangedType)
    Console.WriteLine(vbTab & "OldIndex = " & args.OldIndex)
    Console.WriteLine(vbTab & "NewIndex = " & args.NewIndex)
End Sub

적용 대상

추가 정보