Input to ComboBox in C #

I have a ComboBox in menu mode with a huge number of names, and the user is prompted to select a specific one.

If the user wants, say, β€œNeil,” then they first press β€œn”, which calls the first name starting with β€œn”: for example, Nash. Then, quickly after pressing "n", they press "e", which they expect will call all names starting with "ne", however this is not what happens. It calls all names starting with "e".

No matter how fast the user types, if they type β€œneil” with the field in focus, it will generate names starting with β€œl”.

Is there any way to change this behavior?

+4
source share
1 answer

You must set the following properties:

 comboBox1.AutoCompleteMode = AutoCompleteMode.Suggest; comboBox1.AutoCompleteSource = AutoCompleteSource.HistoryList; 

and he will do what you expect.

AutoCompleteSource has a few more features. You will find help on MSDN.

+6
source

Source: https://habr.com/ru/post/1384215/


All Articles