Difference of Keypress and KeyDown event

  • Thread starter Thread starter windy
  • Start date Start date
W

windy

What's the difference between Keypress and KeyDown event?
looks like some key cannot be handled by both event.
Can anyone list out the details and their usage for best pratice?
 
KeyPress is invoked only for character (printable) keys where as KeyDown is
raised for nonprintable such as Control, Shift, etc.

If you want to filter character input (such as allowing only numeric) then
KeyPress is a better choice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top