Keypress code at form level

M

MNT

I'm trying to copy a value to one of many textboxs on a form. I have a Form_keypress event but the code cannot figure out what control I want to deal with. I don't want to write the event at the control level since of have over 100 textboxes on the form that need to access this function. How can I write the code once and have it work for any control?
 
T

TC

That's not too clear.

When the user presses a key, what is it that you wish to happen?

TC


MNT said:
I'm trying to copy a value to one of many textboxs on a form. I have a
Form_keypress event but the code cannot figure out what control I want to
deal with. I don't want to write the event at the control level since of
have over 100 textboxes on the form that need to access this function. How
can I write the code once and have it work for any control?
 
M

MNT

Sorry for the unclearness. I have textboxes I want to fill with the key pressed i.e., control+A fills 1 to the textbox and the next two textboxes. There are many textboxes on the form so I don't want to have to write the event on every contol

I have the Key Preview property set to True for the form, too.
 
T

TC

Mike, please continue in the other thread.

TC


MNT said:
Sorry for the unclearness. I have textboxes I want to fill with the key
pressed i.e., control+A fills 1 to the textbox and the next two textboxes.
There are many textboxes on the form so I don't want to have to write the
event on every contol.
 

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

Top