var source = new AutoCompleteStringCollection();
// Add your collection of strings.
source.AddRange(new[] { "Guybrush Threepwood", "LeChuck" });
var textBox = new TextBox
{
AutoCompleteCustomSource = source,
AutoCompleteMode = AutoCompleteMode.SuggestAppend,
AutoCompleteSource = AutoCompleteSource.CustomSource
};
form.Controls.Add(textBox);
This will autocomplete the as the user tries to type G or L.
AutoCompleteMode.SuggestAppend
will both display a list of suggested values and it will auto type the first match, Append
only and Suggest
only are available, too.