Winforms Textbox has a property called AutoCompleteMode, that can be used to display textbox values like a predictive Google search. You can provide a custom list of items that can be used as values in textbox.
The following code snippet demonstatrates implementation.
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | private void Form1_Load(object sender, EventArgs e) { tbCountry.AutoCompleteMode = AutoCompleteMode.Suggest; tbCountry.AutoCompleteSource = AutoCompleteSource.CustomSource; tbCountry.AutoCompleteCustomSource = CountryList(); } private AutoCompleteStringCollection CountryList() { AutoCompleteStringCollection List = new AutoCompleteStringCollection(); List.Add("Albania"); List.Add("Algeria"); List.Add("America"); List.Add("Angolia"); List.Add("Antartica"); List.Add("Australia"); List.Add("India"); return List; } |