Combobox select item in dropdown list C#

Posted by Willem T on Stack Overflow See other posts from Stack Overflow or by Willem T
Published on 2012-08-29T09:14:45Z Indexed on 2012/08/29 9:38 UTC
Read the original article Hit count: 175

Filed under:
|
|

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);

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms