August 2003
Intermediate to advanced
736 pages
14h 48m
English
In Windows Forms development, there often comes a time when you need to populate a number of controls with data from a database or other data source. Recall our example from Chapter 12: Data Sets and Designer Support, which used a data set populated from a database. Whenever the data set was changed, such as when the user added a row or deleted a row, we had to repopulate the list boxes so that the display was kept in sync with the data:
void addRowMenuItem_Click(object sender, EventArgs e) {
// Add a new typed row
CustomerSet.CustomersRow row =
this.customerSet1.Customers.NewCustomersRow();
row.CustomerID = "SELLSB";
...
this.customerSet1.Customers.AddCustomersRow(row);
// Update list box
PopulateListBox();
}
Writing code to do ...
Read now
Unlock full access