Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

4. Windows Forms Data Binding

4.11 In my databound ComboBox, how do I set the SelectedItem property?


Use the FindStringExact method. For example, if you have set the ComboBox's ValueMember property to "OrderID", then you could call

comboBox1.SelectedIndex = comboBox1.FindStringExact(stringOrderID);

where stringOrderID is the "orderID" of the row to be selected.