I have a textbox tbx. For it I had an event handler:
publi开发者_运维问答c void tbxPress(object sender, KeyPressEventArgs e)
{
MessageBox.Show("message 1");
if (e.KeyChar == 13) // i.e. on Enter
{
MessageBox.Show("message 2");
}
}
and it worked perfect until I set AutoCompleteMode parameter of tbx.
After that auto-complete works fine, but on Enter i don't get "message 2". ... the hell?!
VC#2008EE
You can use the KeyDown event and check e.KeyCode == Keys.Enter.
精彩评论