How can I select the item in the comboBox with key "02"?
public class GenericComboBox
{
private string _key = string.Empty;
private string _value = string.Empty;
public string Key
{
get { return _key; }
set { _key = value; }
}
public string Value
{
get { return _value; }
set { _value = value; }
}
public GenericComboBox(string key, string value)
{
_key = key;
_value = value;
}
}
//Add data
IList<GenericComboBox> data = new List<GenericComboBox>();
data.Add(new GenericComboBox("01", "01 text"));
data.Add(new GenericComboBox("02", "02 text"));
data.Add(new GenericComboBox("03", "03 text"));
comboBox1.DataSource = data;
comboBox1.ValueMember = "Value";
//comboBox1.SelectItem With key equal "02"
Thank you.