CollectionChanged Event
Collapse the table of content
Expand the table of content

DataColumnCollection.CollectionChanged Event


Occurs when the columns collection changes, either by adding or removing a column.

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

public event CollectionChangeEventHandler CollectionChanged

Use the Contains and CanRemove methods to determine whether a column exists and can be removed.

The following example adds an event handler for the CollectionChanged event.

private void AddEventHandler(DataTable table)
    DataColumnCollection columns = table.Columns;
    columns.CollectionChanged += new 

private void ColumnsCollection_Changed(object sender, 
    System.ComponentModel.CollectionChangeEventArgs e)
    DataColumnCollection columns = 
        (DataColumnCollection) sender;
    Console.WriteLine("ColumnsCollectionChanged: " 
        + columns.Count);

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft