Please help me.
I want to attach listbox to textbox.Listbox has items added into them,when i enter char on textbox then similar items in listbox will be shown as like dropdown and we can select item using arrow keys.List box size should increases dynamically.
Loading
Hemant SrivastavaPosted Nov 13, 2013, 9:31 AM
private void txtBx_TextChanged(object sender, EventArgs e)
{
// Clear the selection for every new character entered
cmbBx.SelectedItem = null;
// get the list from ComboBox
var itemList = cmbBx.Items;
// Iterate each element in the comboBox to check which element has TextBox substring
foreach(var item in itemList)
{
if (item.ToString().Contains(txtBx.Text))
{
// If found show that item on the ComboBox and exit the loop
cmbBx.SelectedItem = item;
break;
}
}
}
If it helps you, please mark it accepted answer.