What is the point of PreviewKeyDown?

  • Thread starter Thread starter Jeff Johnson
  • Start date Start date
J

Jeff Johnson

This seems like one of the most useless events in the Forms namespace. You'd
think that it would give you the ability to examine keystrokes early on and
potentially cancel them, but cancelling is the main function it lacks.
Therefore, when would anyone EVER use this event as opposed to KeyDown?
 
This seems like one of the most useless events in the Forms namespace. You'd
think that it would give you the ability to examine keystrokes early on and
potentially cancel them, but cancelling is the main function it lacks.
Therefore, when would anyone EVER use this event as opposed to KeyDown?

Because KeyDown won't propagate to the final Control.

Here is one use : http://blogs.msdn.com/jfoscoding/archive/2006/01/26/518181.aspx

Another : if (e.KeyChar == 27) CloseDialog();

And so on...

Michel
 

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