| |||||||
DataColumnCollection.CollectionChanged EventSystem.Data Namespace DataColumnCollection Class Occurs when the columns collection changes, either by adding or removing a column. [ VB ] Public Event CollectionChanged As CollectionChangeEventHandler [ C# ] public event CollectionChangeEventHandler CollectionChanged; [ C++ ] public: __event CollectionChangeEventHandler* CollectionChanged; [ JScript ] In JScript, you can handle the events defined by a class, but you cannot define your own. Event DataThe event handler receives a CollectionChangeEventArgs containing data related to the CollectionChanged event. The following CollectionChangeEventArgs properties provide information specific to this event.
RemarksThe Contains and CanRemove methods can be used to determine if a column exists and can be removed. ExampleThe following example adds an event handler for the CollectionChanged event. private void AddHandler ( DataTable myTable ) {
DataColumnCollection cols=myTable.Columns;
cols.CollectionChanged +=
new System.ComponentModel.CollectionChangeEventHandler (
DataColumnCollection_Changed );
}
private void DataColumnCollection_Changed ( object sender,
System.ComponentModel.CollectionChangeEventArgs e ) {
DataColumnCollection cols= ( DataColumnCollection ) sender;
Response.Write ( "DataColumnCollectionChanged: " + cols.Count );
}
See Also |
| ||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme