BindingSource.DataSource Propriedade
Assembly: System.Windows.Forms (em System.Windows.Forms. dll)
private void Form1_Load(System.Object sender, System.EventArgs e) { // Create and populate the list of DemoCustomer objects // which will supply data to the DataGridView. List<DemoCustomer> customerList = new List<DemoCustomer>(); customerList.Add(DemoCustomer.CreateNewCustomer()); customerList.Add(DemoCustomer.CreateNewCustomer()); customerList.Add(DemoCustomer.CreateNewCustomer()); // Bind the list to the BindingSource. this.customersBindingSource.DataSource = customerList; // Attach the BindingSource to the DataGridView. this.customersDataGridView.DataSource = this.customersBindingSource; }
private void Form1_Load(Object sender, EventArgs e)
{
// Create and populate the list of DemoCustomer objects
// which will supply data to the DataGridView.
List<DemoCustomer> customerList = new List<DemoCustomer>();
customerList.Add(DemoCustomer.CreateNewCustomer());
customerList.Add(DemoCustomer.CreateNewCustomer());
customerList.Add(DemoCustomer.CreateNewCustomer());
// Bind the list to the BindingSource.
this.customersBindingSource.set_DataSource(customerList);
// Handle the ListChanged event.
this.customersBindingSource.add_ListChanged(
new ListChangedEventHandler(customersBindingSource_ListChanged));
// Attach the BindingSource to the DataGridView.
this.customersDataGridView.set_DataSource(this.customersBindingSource);
} //Form1_Load