DataGrid.DataSourceChanged Event


Occurs when the DataSource property value has changed.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event EventHandler DataSourceChanged

The DataSourceChanged event occurs when the DataMember value changes, or when the BindingContext of the DataGrid changes.

The following code example demonstrates the use of this member.

private System.Windows.Forms.DataGrid dataGrid1;

 private void CreateDataGrid()
    dataGrid1 = new DataGrid();
    // Add the handler for the DataSourceChanged event.
    dataGrid1.DataSourceChanged += new EventHandler(DataGrid1_DataSourceChanged);


 private void DataGrid1_DataSourceChanged(object sender, EventArgs e)
    DataGrid thisGrid = (DataGrid) sender;

.NET Framework
Available since 1.1
Return to top