Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In .Net, what's the better choice to code key presses in keyboard, key-up or keydown?

Are the two events the same or are there differences that we should take note when coding the keyboard presses?

like image 814
user26087 Avatar asked Dec 02 '22 08:12

user26087


1 Answers

My answer here is just based on experimenting with different applications, not programming per se.

Handle the keydown. Let that be the trigger for your logic. That's what the user would expect based on interacting with other applications.

For example, try a key down in Notepad, and you'll see that the DOWN triggers the reaction in Notepad. It doesn't wait for the UP.

like image 114
Corey Trager Avatar answered May 25 '23 19:05

Corey Trager