I am trying to implement a textbox autocomplete with a custom datasource in the form of an array which shows suggestions on single character input. But when i run the progra
AutoComplete
suggests after the second char is being pressed is normal because in the first place, you have initialized the arr
(which is your custom datasource) into an empty array. You have populated your arr
in TextChanged
event and that's why AutoComplete
works at the second char because your datasource is filtered based on your first char (which is definitely what you don't want).
Here's a suggestion:
On the FormLoad
event of your application, fill arr
with all the possible suggestions (I think the source of suggestion is from database right?). This will allow textbox to suggest on your first char.
When you have entered the first char, on the TextChanged
event reload your arr
datasource based on the prevous character being entered.
Hope it helps.