Charles Morissette

Charles Morissette

  • NA
  • 29
  • 42.9k

Combobox List Select

May 6 2011 8:30 PM
I have a combo box I have loaded with a few items. What I am trying to do is make it so when someone puts text in, it will look for that partial text in the combobox and select that item in the drop down menu.

My code is

[CODE]
private void itemPicker_TextChanged(object sender, EventArgs e)
{
string Find = string.Empty;
itemPicker.SelectedItem = itemPicker.FindString(itemPicker.Text);
}
[/CODE]

It works if the text is at the start - (EX : I type Star W, it will go over Star Gate and Star Trek and select Star Wars). But if I type in Wa, it will not select Star Wars, which is what I would like it to do. Any tips on what to use to build a search myself (I'm thinking of going with a "for"/"for each" loop to go through all the items, but don't what command displays the item index on the drop down menu) or a command I don't know about would be appreciated.

Answers (1)