How can I populate a combo box in C# with an array that my display member is the value of array and the value member is the array key?
string[] RelayTypeArray = new string[4];
RelayTypeArray[0] = null;
RelayTypeArray[1] = "Boiler";
RelayTypeArray[2] = "Valve";
RelayTypeArray[3] = "Pump";
cmb_RelayType.DataSource = RelayTypeArray;
cmb_RelayType.DisplayMember = RelayTypeArray;
cmb_RelayType.ValueMember = ?????
just use your array as it is…
if you want the text:
cmb_RelayType.SelectedValueif you want the index:
cmb_RelayType.SelectedIndex