Combobox select item in dropdown list C#
- by Willem T
I have an combobox poppulated with items from a database table.
When I change the text i repopulate the combobox with items from the database table.
But when I enter text and the list with suggestions opens no item in de list is selected.
And i want a item to be selected so when you press enter that it becomes the selected item.
This is a winforms application.
Thanks.
cbxNaam.Items.Clear();
string query = "SELECT bedr_naam FROM tblbedrijf WHERE bedr_naam LIKE '%" + cbxNaam.Text + "%'";
string[] bedrijfsnamen = Functions.DataTableToArray(Global.db.Select(query));
cbxNaam.Items.AddRange(bedrijfsnamen);
cbxNaam.Select(cbxNaam.Text.Length + 1, 0);