Roman Goyenko
Roman Goyenko

Reputation: 7080

ComboBox case sensitive dropdown

I have a ComboBox control of DropDown type which contains items "AAA", "Aaa", "Aa+", etc.

The problem is: If I type Aaa, item "AAA" highlighted as selected, not "Aaa". I assume combobox uses FindString to find SelectedItem - so search result is equivalent to first matched item by case-insensitive string.StartsWith.

What do I need to change to override this behavior?

I need to be able to type in the ComboBox.

Is there a method in winforms I could override or some kind of property akin to WPFs IsTextSearchCaseSensitive property from sll's answer?

Upvotes: 8

Views: 4736

Answers (2)

Flo
Flo

Reputation: 31

You can use this:

myComboBox.SelectedIndex = myComboBox.Items.IndexOf("CaseSensitiveTextHere");

Upvotes: -1

sll
sll

Reputation: 62504

If you are using WPF, just set IsTextSearchCaseSensitive property to true.

Upvotes: 3

Related Questions