Built into a .NET TextBox is AutoComplete functionality. First you set the AutoCompleteMode property (Suggest, Append, etc.), and then you choose the AutoCompleteSource. Your choices for that are:
FileSystem
HistoryList
RecentlyUsedList
AllUrl
AllSystemSources
FileSystemDirectories
CustomSource
None
ListItems
In your case, you'd use CustomSource, and then populate the AutoCompleteCustomSource Collection that's a property on the TextBox. I would suggest to have a simple SqlCe database, to where you can store the values the user has entered in the past, and then when the app loads, retrieve those values, and populate the AutoCompleteCustomSource.
A quick code sample:
private void button1_Click(object sender, EventArgs e)
{
this.textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
this.textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
string[] items = GetListForCustomSource();
this.textBox1.AutoCompleteCustomSource.AddRange(items);
}
private string[] GetListForCustomSource()
{
var result = new List<string>();
foreach(var value in Enum.GetNames(typeof(DayOfWeek)))
{
result.Add(value);
}
return result.ToArray();
}
I jsut used DayOfWeek as an example, but you can query a database in that method, and return the results.