Keypress code at form level

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

Guest

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?
 
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?
 
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.
 
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.
 
Back
Top