KeyPress in Control

  • Thread starter Thread starter Peter Osawa
  • Start date Start date
P

Peter Osawa

Hi,

I'm making a form with a statusbar. I added a custom control to
statusbar (That control has only a textbox).

I set KeyPreview to True on the form. Now I can monitor all keys
pressed, but I want to know if it is possible to pass the parent form to
my contol and process keypresses inside my contol, without coding my
contols logic in the main form ?

TIA
 
* Peter Osawa said:
I'm making a form with a statusbar. I added a custom control to
statusbar (That control has only a textbox).

I set KeyPreview to True on the form. Now I can monitor all keys
pressed, but I want to know if it is possible to pass the parent form
to my contol and process keypresses inside my contol, without coding
my contols logic in the main form ?

You can use 'AddHandler' in combination with 'Me.FindForm()' inside the
usercontrol to add a handler to the form's 'KeyPress' event.
 
Thank you very much !!!

You can use 'AddHandler' in combination with 'Me.FindForm()' inside the
usercontrol to add a handler to the form's 'KeyPress' event.
 

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