Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Experts,

I want to get the index value of combobox with the value as parameter.

Foe Example

My Combobox has
consumer
Commerial
Cosumer OPP

Now If I pass Consumer , I should the index of that combox.

Could someone help me please. Very important
Posted

1 solution

You use the the method ComboBox.Items.IndexOf. The issue you will run into is how the objects in the collection compare themselves. If you do not override the Equals method on your custom objects, the default operation will simply compare references and not the values of the object properties.

ComboBox.ObjectCollection.IndexOf[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900