DataView.ListChanged Event


Occurs when the list managed by the DataView changes.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

Public Event ListChanged As ListChangedEventHandler

The following example adds a handler for the ListChanged event of a DataView.

Public Sub CreateDataView(table As DataTable) 
    Dim view As DataView = 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(vbTab & "    Type = " & args.ListChangedType)
    Console.WriteLine(vbTab & "OldIndex = " & args.OldIndex)
    Console.WriteLine(vbTab & "NewIndex = " & args.NewIndex)
End Sub

.NET Framework
Available since 1.1
Return to top