views:

32

answers:

1

I have a textbox tbx. For it I had an event handler:

public 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

+2  A: 

You can use the KeyDown event and check e.KeyCode == Keys.Enter.

Tergiver
thx! it works. i wonder why it didn't before
Halst