Quantcast
Channel: Handle Enter KeyPress
Viewing all articles
Browse latest Browse all 14

Handle Enter KeyPress

$
0
0

Hendri,

I (and others) never use the keypress, we use mostly the keydown (while I use the keyup), returns more information in the eventargument e.

 http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keyup.aspx

 


Success
Cor


It really needs to be noted that KeyDown/KeyUp and KeyPress are very, very different things and the level of data returned by event arguments is only the tip of the iceberg. 

KeyDown occurs at any time that a key is registered as DOWN which means (for example) that if you press and hold the S key, the KeyDown event will fire every 1/15th of a second or so (depending on the typomatic repeat rate specified in your system BIOS or Windows settings).

KeyUp occurs at any time that a key is registered as UP which means (following the first example) that if you press and hold the S key, the KeyDown event will fire every 1/15th of a second or so (depending) and the KeyUp event will fire only when you release the key.

KeyPress occurs at any time that a key is pressed and released, no matter how long you held the key down. EDIT:  This is WRONG!  KeyPress occurs every time the held key repeats too; KeyUP is the only event that reliably filters a single physical keyboard event, independent of typomatic repeat.


It never hurts to try. In a worst case scenario, you'll learn from it.

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>