0

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".

Gaurang Dave
  • 3,956
  • 2
  • 15
  • 34
Face Rast
  • 19
  • 5
  • 1
    WinForms autocomplete can only search from the begining. You need to implement your own autocomplete. – vasily.sib May 28 '19 at 02:55
  • can you give me any examples ? – Face Rast May 28 '19 at 03:01
  • u can refer this one: https://stackoverflow.com/questions/3694720/combobox-autocomplete-on-substring – BeiBei ZHU May 28 '19 at 03:02
  • [one](https://stackoverflow.com/questions/43254621/customize-textbox-autocomplete), [two](https://stackoverflow.com/questions/3694720/combobox-autocomplete-on-substring), [three](https://stackoverflow.com/questions/11780558/c-sharp-winforms-combobox-dynamic-autocomplete), [four](https://stackoverflow.com/questions/515561/how-can-i-dynamically-change-auto-complete-entries-in-a-c-sharp-combobox-or-text), [five](https://stackoverflow.com/questions/8762982/c-sharp-create-custom-autocomplete-textbox), should I proceed? – vasily.sib May 28 '19 at 03:04

1 Answers1

-1
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!