Button and detect key pressed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a form with a button and when I click in this button, how I can detect the keys pressed and put this keys pressed in text property of the button.

Thanks

Silvia
 
* =?Utf-8?B?U2lsdmlh?= said:
I have a form with a button and when I click in this button, how I can detect the keys pressed and put this keys pressed in text property of the button.

Set the form's 'KeyPreview' property to 'True', add a handler to its
'KeyDown' and 'KeyUp' events and store the pressed keys for example in a
'Hashtable'. In 'KeyUp', you can remove them from the table (untested).
 

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