Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Customer
- {
- public int Id {get; set;}
- public int Name {get; set;}
- }
- combobox.DisplayMember = "Name";
- combobox.ValueMember = "Id";
- public Class Customer {
- public int CustomerId { get; set; }
- public string First { get; set; }
- public string Last { get; set; }
- // here is where you decide what to display in the combo box:
- public override string ToString() { return First + Last; }
- }
- // declare customers
- Customer []myCustomers = null;
- // load customers ... then show:
- myCombobox.Items.AddRange(myCustomers);
- var customerObject = (Customer)myCombobox.Items[myCombobox.SelectedIndex];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement