Combobox binding
I'm using the mvvm model, I've setup a property in the view model to retrieve combobox values from the model. The combobox is all fine and I know how to bind the selected value to a property. The combobox value is a value part of the customer table called customer type and the value is customertypeid. how do I set the combobox default value to be value from customer table. And once it's changed how does it update the customer table?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Shankar MRank #874 · 2.5K reputationPosted Nov 26, 2012, 10:37 PM EST
Hi User,
You can use the ComboBox SelectedItem Property or ComboBox SelectedIndex property to do it.
SelectedItem Property:
comboBox1.SelectedItem= "Graduate";
SelectedIndex Property:
comboBox1.SelectedIndex = 1; ( for first Item in the Collection Index is 0,and next is 1 and so on..)
Thanks,
Shankar
Czhang Rego3 reputationPosted Nov 27, 2012, 12:16 PM EST