DataGrid.DataSourceChanged Event

Definition

Occurs when the DataSource property value has changed.

C#
public event EventHandler DataSourceChanged;

Event Type

Examples

The following code example demonstrates the use of this member.

C#
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;
 }

Remarks

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

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0

See also