Compartir a través de


DataGrid.DataSourceChanged Evento

Definición

Se produce cuando cambia el valor de la propiedad DataSource.

public:
 event EventHandler ^ DataSourceChanged;
public event EventHandler DataSourceChanged;
member this.DataSourceChanged : EventHandler 
Public Custom Event DataSourceChanged As EventHandler 

Tipo de evento

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este miembro.

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);
   }
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;
 }
Private dataGrid1 As System.Windows.Forms.DataGrid


Private Sub CreateDataGrid()
    dataGrid1 = New DataGrid()
    ' Add the handler for the DataSourceChanged event.
    AddHandler dataGrid1.DataSourceChanged, AddressOf DataGrid1_DataSourceChanged
End Sub
 

Private Sub DataGrid1_DataSourceChanged(sender As Object, e As EventArgs)
    Dim thisGrid As DataGrid = CType(sender, DataGrid)
End Sub

Comentarios

El DataSourceChanged evento se produce cuando cambia el DataMember valor o cuando cambia el BindingContext de DataGrid .

Se aplica a

Consulte también