C# Tutorial 84: How to Create An AutoComplete TextBox In C#

ProgrammingKnowledge · 163K views · 2013 · 7:33

Open on YouTube

Software (other)Testing, debugging & developer toolstutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about getting a C# TextBox to suggest or filter entries from a list or database.

Recommended by 1 people across 1 different months, 2013 to 2017.

What it is

A short beginner tutorial from ProgrammingKnowledge showing how to add autocomplete to a TextBox in a C# Windows Forms app. It covers using the built-in AutoComplete properties with a custom list of suggestions.

What people said

Recommends Juan Carlos Oropeza · 2017-09 · Stack Overflow · on “Auto-complete Textbox not working”

The autocomplete seem very straight forward. You can first use a hard code list of data to test it and then add the db component. Here is an example. [this video]

Cites Brian · 2013-09 · Stack Overflow · on “Autocomplete or filter from a list created by a SQL Command”

There are several ways to do this; you can use the AutoCompleteCustomSource , AutoCompleteMode and AutoCompleteSource properties for the control in question (click the control and press F4). Or, you can do it at run-time like this: yourTextBoxNameHere.AutoCompleteSource = AutoCompleteSource.AllSystemSources; yourTextBoxNameHere.AutoCompleteMode = AutoCompleteMode.SuggestedAppend; Or, you can load a custom source and databind it to your control: yourTextBoxNameHere.AutoCompleteSource = AutoCompleteSource.CustomSource; Tutorials, here [LINK] , here [this video] and here [LINK] .

Cites Hexie · 2016-05 · Stack Overflow · on “ContextMenuStrip scrolling up and down arrows information c#”

As suggested in the comments and with the OP, this design might need to re-thought. The adopted approach will be to use an AutoComplete box, linked to a datasource, whereby the user can type in the field they are wanting (this is known) and select the field from the suggestions displayed. This would then add the field to the same area as previously described - providing, a faster and more UX friendly way of doing this; Some URL's to help with autocomplete: TextBox AutoComplete [LINK] [this video] ToolStrip Text Box [LINK] (using autoComplete within a ToolStrip TextBox)