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
 
Back
Top