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 {
	void add(EventHandler^ value);
	void remove(EventHandler^ value);
}

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;

   void CreateDataGrid()
   {
      dataGrid1 = gcnew DataGrid;
      // Add the handler for the DataSourceChanged event.
      dataGrid1->DataSourceChanged += gcnew EventHandler(
         this, &Form1::DataGrid1_DataSourceChanged );
   }

   void DataGrid1_DataSourceChanged( Object^ sender, EventArgs^ /*e*/ )
   {
      DataGrid^ thisGrid = dynamic_cast<DataGrid^>(sender);
   }

.NET Framework
Available since 1.1
Return to top
Show: