Background:
I have Forms.ComboBox with DropDownStyle = DropDown .
I do not use AutoComplete , but I implemented something similar, which not only filters the beginning of the text, but also uses a regular expression and shows all the elements that match the entered text. It works great.
However, when I type the first letter of the corresponding element, the ComboBox returns to its original behavior and sets DroppedDown = true and automatically selects the first record and completes the text according to the selected element (similar to AutoCompleteMode Add). I want there to be no automatic selection and no automatic completion.
What I have found so far is that I somehow have to prevent SendMessage() from CB_FINDSTRING to call and replace CB_FINDSTRING with CB_FINDSTRINGEXACT ( MSDN link ).
I think I need to extend the ComboBox class, but I'm not sure which methods I need to override. I am working with C # .NET Framework v3.5.
Questions:
- How to extend
Windows.Forms.ComboBox to prevent automatic selection behavior?
References:
How to prevent automatic selection in ComboBox from the drop-down list, except for exact matches? (didn't help me)
Jonas frei
source share