Can someone tell me what is the difference between the
key_down and key_press events
Printable View
Can someone tell me what is the difference between the
key_down and key_press events
Hi,
Quote from MSDN
Hope this helps,Quote:
The KeyUp and KeyDown events report the exact physical state of the keyboard itself: A key is pressed down (KeyDown) and a key is released (KeyUp). In contrast, the KeyPress event does not report the state of the keyboard directly — it doesn't recognize the up or down state of the key, it simply supplies the character that the key represents.
Shaun
KeyAscii is used more when working with the actual character's (letters, numbers etc.) that the key generates whereas KeyDown is only concered with the state of the key (if it's pressed).
Yes, the KeyPress event will not be raised for keys like the Arrow keys or the Function keys or any other key that don't have an ascii value. The KeyDown event on the other hand will be raised for any key pressed.