AutoComplete textbox is used for completing a text automatically when you type some alphabet in the textbox. It is used for searching and filtering the text in a fastest way.
Here I am explaining how to implement the autocomplete textbox in windows form.
Please design the following windows form:
Here, I have a textbox where I should type the text to search.
Here, I have the database table from where I searched the name that is typed in the textbox.
Code
Now while running the form it will look like this.
When selecting any name, the data will be filled in the datagrid.
AutoCompleteMode property defines how text is suggested in the TextBox. It can be set to a AutoCompleteMode enumeration, Append, Suggest, SuggestAppend, and None. Suggest displays all the suggestions as dropdown. Append displays first value of the suggestion appended or selected in the TextBox, other values can be navigated using arrow keys. SuggestAppend displays suggested values as dropdown and first value appended in the TextBox.
AutoCompleteSource property sets the source for auto complete data. It can be set to a AutoCompleteSource enumeration, FileSystem, HistoryList, RecentlyUsedList, AllUrl, AlSystemSources, FileSystemDirectories, CustomSource or None. As we are getting our own data we set it to CustomSource.
Thus in this way we can create autocomplete textbox like this.