Hello,
Please try this solution. It works in my side.
In you combo box
1. set these properties
AutoCompleteMode = SuggestAppend
AutoCompleteSource = None
DropDownStyle = ComboBoxStyle.DropDown;
2. Add KeyPress event handle and write this
public virtual void Cbo_KeyPress(object sender, KeyPressEventArgs e)
{
ComboBox cb = (ComboBox)sender;
cb.DroppedDown = true;
string strFindStr = "";
if (e.KeyChar == (char)8)
{
if (cb.SelectionStart <= 1)
{
cb.Text = "";
return;
}
if (cb.SelectionLength == 0)
strFindStr = cb.Text.Substring(0, cb.Text.Length - 1);
else
strFindStr = cb.Text.Substring(0, cb.SelectionStart - 1);
}
else
{
if (cb.SelectionLength == 0)
strFindStr = cb.Text + e.KeyChar;
else
strFindStr = cb.Text.Substring(0, cb.SelectionStart) + e.KeyChar;
}
int intIdx = -1;
intIdx = cb.FindString(strFindStr);
if (intIdx != -1)
{
cb.SelectedText = "";
cb.SelectedIndex = intIdx;
cb.SelectionStart = strFindStr.Length;
cb.SelectionLength = cb.Text.Length;
e.Handled = true;
}
else
e.Handled = true;
}
Thanks. Hope it helps!