Advertisement
Advertisement
| 06.09.2008 at 09:35AM PDT, ID: 23469651 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: |
/* Create a new Customer */
Customer cust = new Customer("Joe", null);
/* Add null value */
DataRow row = statesTable.NewRow();
/* Enter a null row (ComboBox will show blank) */
row["Name"] = "";
row["Code"] = DBNull.Value;
/* Add the row to DataTable */
statesTable.Rows.Add(row);
/* Bind the States ComboBox to the states DataTable */
this.statesCB.DisplayMember = "Name";
this.statesCB.ValueMember = "Code";
this.statesCB.DataSource = statesTable;
/* Bind the ComboBox SelectedValue to the customer */
/* business object */
this.statesCB.DataBindings.Add("SelectedValue", cust, "StateID", true);
|