I have a combobox that I populate like this:
this.reqTypeInput.Items.Add(new RequestType(\"Label 1\", \"Value1\"));
this.reqTypeInput.Items.Add(new RequestType(\
It looks like you are trying to find the index as though your ComboBox
contains just string values, when it actually contains RequestType
objects. Have you tried overriding your Equals
operator?
Check out this SO post, and this one for examples of overriding Equals
.
EDIT: As mentioned in another answer, a good practice is to populate a collection of objects that you want in the ComboBox
, then bind that collection to your ComboBox
. The first link in my answer here has an example of that.