DELETE button not captured by KeyPress event

A small but important thing – if you want to capture pressing the DELETE button in a WinForms project, you’ll need to do it in the KeyDown or KeyUp event, not the KeyPress event.  As the documentation (here and here) points out, KeyPress deals mostly with character keys, and non-character keys won’t raise it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s