Form1_KeyDown doesn't fire

  • Thread starter Thread starter genc ymeri
  • Start date Start date
G

genc ymeri

Hi,
I have a C# from and I'm trying to add some code in onKeyDown event. But it
doesn't fire at all............

Any idea ?

Thanks a lot.
 
If a control on your form has focus, your form won't receive the message unless you set KeyPreview to true.
 
OnKeyDown will only fire for the control that currently has focus.

However, if you want to capture it in your form, you can set the KeyPreview
property (on the form) to "true", and the OnKeyxxx events will fire for the
form, then (if you didn't cancel them) for the control.

Note that the OnKeyxxx events won't fire on the form for all keys (like the
arrow keys)
 
oh.....I thought I had already set that :(

thanks a lot.

Charlie Williams said:
If a control on your form has focus, your form won't receive the message
unless you set KeyPreview to true.
 
Back
Top