简体   繁体   中英

Need to search substring or any matching string using auto complete entered in the textbox using C#

I am trying to make a search tool but my textbox auto complete cannot search for substring,it only shows result for auto complete if the match is equivalent.

I have tried the autocomplete textbox and auto complete combo box,I need a search where if user puts in ab all string containing the substring ab should pop up.

already tried auto complete mode both text box and combo box.

textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection col = new AutoCompleteStringCollection();
col.Add("Foo");
col.Add("Bar");
textBox1.AutoCompleteCustomSource = col;

This works only when I search "F" or "B" but not with the substring "oo" or "ar".

textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection col = new AutoCompleteStringCollection();
col.Add("Foo");
col.Add("Bar");
textBox1.AutoCompleteCustomSource = col;

Keep coding!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM