I have a ComboBox with AutoCompleteMode = suggestand handle a KeyPress event as follows:
private void searchBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
{
}
}
However, he does not catch the key Enter. It catches the rest, since the autocomplete drop-down menu works fine.
I also tried the suggestion here: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/2db0b540-756a-4a4f-9371-adbb92409806 , set the property KeyPreviewto true and put a breakpoint on the form KeyPress Event Handler:
private void Form_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = false;
}
However, even the form handler did not catch the input key!
Any suggestions?
(If I turn off autocomplete, it will catch the Enter key)
source
share