// [in designer] textBoxInContext.AutoCompleteMode = Suggest
// [in designer] textBoxInContext.AutoCompleteSource = CustomSource
AutoCompleteStringCollection autoComplete = new AutoCompleteStringCollection();
autoComplete.AddRange(myArrayofStrings);
textBoxInContext.AutoCompleteCustomSource = autoComplete;
I have this code which works well as documented in MSDN.
Problem: if user types "PS" it shows all the string starting with "PS"; I would like to display all the strings containing "PS"
Any pointers ?
If you don't find another way, I suggest doing it manually:
combobox.TextChanged
or KeyUp
event take its text and compare it to your string array whichever way you want and, after clearing the combobox.Items
, add the found results to the combobox.Items
and make sure to set the DroppedDown
property to true if you have found suggestions.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With