DataView.ListChanged 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
更改由 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