TextBox, KeyDown and Enter

Hi all,

I have written a tiny application with a TextBox on a form, where the TextBox has a KeyDown event handler like this:


private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
e.Handled =
true;
MessageBox.Show("You pressed Enter!");
}
else if (e.KeyCode == Keys.Escape)
{
e.Handled =
true;
MessageBox.Show("You pressed Esc!");
}
}

When I run this program on a Windows Mobile 2003 device (a Psion Workabout Pro), it works just fine.

However, when I run the same program on a Windows Mobile 5.0 device (an Intermec CK61) the Enter key doesn't work. Esc pops up the message, but Enter just beeps and nothing happens.

Does someone out there have a WM 5.0 device with an enter key that they can try this code on I don't understand why it's not working.

Thanks,
Matt



Answer this question

TextBox, KeyDown and Enter

  • XBTester

    I have the exact same problem on a Qtek 9000 running Windows Mobile 5. The Enter key simple does not trigger the event "KeyDown". All other keys are working great.

    Anyony found a solution to this

    Regards

    Jonas


  • Chris49

    Is that a bug in Windows Mobile 5.0 (I'm seeing the same problem.) When is the release due Is there a work-around posted Thanks.

  • DMan1

    So I am able to reproduce this issue you are seeing.

    Doing some more investigation on the underlying cause of this and will post back my findings soon.

    Thanks.


  • Mats Aubell

    My Devices is a Symbol MC70. When I press the Enter Key on TextBox, I receive Keys.F17. instead of Keys.Enter. If I press Enter Key and clear the Controls and reload new Controls on Form with focus on a ComboBox, I then receive an extra Keys.Back, which drops down the Selection Box.


  • leoku

    The issue you described above seems to be specific to your Symbol device. I would suggest you contact someone from Symbol to address this issue.

    Per the other issue described in the initial post, this has been verified to be a bug and it has been fixed in the next release.

    Thanks for reporting this.


  • Kirk Lipscomb

    I figured out a work-around: our Symbol MC9090 barcode gun PocketPC sends Keys.F23 when you press the Enter key, so I test for that along with Keys.Enter. Seems like the Symbol keypad designers are getting creative these days.

  • dan english

    Mark Ihimoyan wrote:
    So I am able to reproduce this issue you are seeing.

    Doing some more investigation on the underlying cause of this and will post back my findings soon.

    Great! Thanks for the follow-up, Mark. Look forward to hearing the results of your investigation!


  • TextBox, KeyDown and Enter