On press of '#' on my MC45 Device i want to call a method. My code looks like:
void MyForm_KeyDown(object sender, KeyEventArgs e)
{
int keyValue = e.KeyValue;
switch (keyValue)
{
case 16: // Do Something
{
}
}
}
the Key Value for '#' is 16. So when i press '#' it works fine but a subsequent call on KeyDown happens with key value '51' every time. Why ?? How do i stop this subsequent call ??
Hans Passant is right, the '#' key events are Shift+3 (US keyboard layout).
For detecing the '#' key press you should use KeyPress event and not KeyDown/KeyUp.
One further possible pitfall: on newer Windows Mobile 6.5.3 the # and * may be mapped to VK_TSTAR and VK_TPOUND and these are mapped to VK_F8 and VK_F9. See winuserm.h:
#define VK_TSTAR VK_F8 // *
#define VK_TPOUND VK_F9 // #
The result of this maybe that your app does not see those * and # presses as they are send as F8 and F9 by the OS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.