Freigeben über


DataGrid.DataSourceChanged Ereignis

Definition

Tritt ein, wenn der DataSource-Eigenschaftswert geändert wurde.

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

Ereignistyp

Beispiele

Im folgenden Codebeispiel wird die Verwendung dieses Members veranschaulicht.

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

Hinweise

Das DataSourceChanged -Ereignis tritt auf, wenn sich der DataMember Wert ändert oder wenn sich der BindingContext des DataGrid ändert.

Gilt für:

Weitere Informationen