0

I have a TextBox in my Windows Forms project which as part of a table holds a description of some material a company will buy. To ensure that the company enforces consistent naming, I have implemented autocomplete on the TextBox as so:

 AutoCompleteStringCollection source = new AutoCompleteStringCollection();
source.AddRange(pastItems);
desc.AutoCompleteCustomSource = source;
desc.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
desc.AutoCompleteSource = AutoCompleteSource.CustomSource;

But when I am typing anything into the TextBox, the dropdown is not populating.

Knowledge Cube
  • 990
  • 12
  • 35
pdixit
  • 1
  • 3
  • 3
    When you put a breakpoint at the line `source.AddRange(pastItems);`, is `pastItems` a List containing actual data ? – Martin Verjans Jun 14 '17 at 13:51
  • Your code looks very similar to what is shown in [this other question's answer](https://stackoverflow.com/a/18216863/3775798) and they indicated in the comments there that it works, so definitely check what @MartinVerjans suggested above. Also, have you considered using a ComboBox control instead? – Knowledge Cube Jun 14 '17 at 14:22
  • based on requirement i need to use only text box – pdixit Jun 15 '17 at 05:54
  • and with textbox i need to show one dropdown which contain all the item filtered based on enterd text in textbox. – pdixit Jun 15 '17 at 06:12

0 Answers0