开发者

Compatibility of textbox AutoCompleteMode and keyPress event, C#

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜