Combobox DropDownList and keypress
I have a dropdown that contains all TimeZone.Displayname
All of these display names are reported as:
(GMT +09: 00) Seoul, (GMT -06: 00) Central Time (US & Canada), etc.
Is there a way to get a keypress event that will look for the first letter after ")"? Right now it only recognizes the first character of the combobox line, which is "("
EDIT
Changed title because time zones are really not related to the issue.
a source to share
You will need to provide the keydown-search functionality yourself. For example, override KeyPress
and whenever a key is pressed in the list and displays the desired list item. Or, you can use a ComboBox.FindString
method to find a string, something like the following:
private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
string findString = string.Empty;
comboBox1.SelectedIndex = comboBox1.FindString(e.KeyChar.ToString());
if(comboBox1.SelectedIndex > -1){e.Handled = true;}
}
a source to share