By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

KeyPress in Control

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* Peter Osawa <po****@sun.es> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #2

P: n/a
Thank you very much !!!
Herfried K. Wagner [MVP] wrote:
* Peter Osawa <po****@sun.es> scripsit:
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.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.