다음을 통해 공유


DataGrid.DataSourceChanged 이벤트

정의

DataSource 속성 값이 변경되면 발생합니다.

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

이벤트 유형

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다.

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

설명

DataSourceChanged 이벤트는 값이 DataMember 변경되거나 의 가 BindingContext 변경되면 발생합니다 DataGrid .

적용 대상

추가 정보