Key down

  • Thread starter Thread starter ooooscar
  • Start date Start date
O

ooooscar

Is there any way to get a key press or key down from all the components of
the form. A mean if a hava a 2 text bo and a press a key into the first i
get a textbox1_keydown event, and if i press a key when i have the focus
into the textbox2 a get textbox2_keydown event but can I get a general event
to get a key from any of them even if i want to get the key down if i have
the focus into a button.

Thank's
Oscar.
 
Take a look at Form.KeyPreview property.

Is there any way to get a key press or key down from all the components of
the form. A mean if a hava a 2 text bo and a press a key into the first i
get a textbox1_keydown event, and if i press a key when i have the focus
into the textbox2 a get textbox2_keydown event but can I get a general event
to get a key from any of them even if i want to get the key down if i have
the focus into a button.

Thank's
Oscar.
 
ooooscar said:
Is there any way to get a key press or key down from all the components of
the form.

If you set the form's KeyPreview property true the form will receive all
keyboard events.

Chris Jobson
 

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