Search code examples
c#winformscombobox

How to narrow the options list in a comboBox by typing - incremental search


I have a combobox that has hundreds item in it. User must be able to type the text into the combobox. While the user is typing the text, the item that starting with the typed value must be selected or listed. The user must be able type continuously. My ComboBox DropDownStyle is DropDownList

E.g: While selecting a name in comboBox by typing, it only allows one letter. So if I type "A" it will jump to the first letter starting with "A". When I type continuously the combo box selected item changes according to the current keypress. If I press "As", combobox viewing the items starting with "s".


Solution

  • comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
    comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
    comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;