Reputation: 25
I want to compare the string with Combobox Member Values. If string value matched, I need the index of matched value as well.
Upvotes: 0
Views: 269
Reputation: 68
possibly this will help you.
private void SampleMethod()
{
cboExample.Items.AddRange(new string[]
{
"Element 1", "Element 2", "Element 3", "Element 4"
});
string searchedText = "Element 3";
int index = cboExample.FindString(searchedText);
MessageBox.Show($"Index of \"{searchedText}\" is {index}");
}
Upvotes: 1