same event for series of textboxes?

  • Thread starter Thread starter Jesper F
  • Start date Start date
J

Jesper F

I have several forms with 40+ textboxes on each.
The data in them is all single digit numbers in each text
box with no exceptions.

What I'd like to do is for the focus/cursor to
automatically move to the next textbox when one digit has
been entered. This would speed up entering data as no
tab/mouse use is needed when needing to move the the next
textbox.

It's a lot of work to manually code the keypress event for
all the control and the code for this would be very
similar for all the controls.
Is there a way to do this in a more clever way? Maybe
something with withevents? Code working across all the
controls in the same event? I'm not sure.
Thanks for any input.
 
Hi Jesper

The easiest way to do this involves no event code at all. Simply give each
of your textboxes an InputMask that will accept a single character/digit,
and set its AutoTab property to Yes/True.

Then, as soon as a digit is entered, focus will move to the next box in the
tab order.
 
The easiest way to do this involves no event code at
all. Simply give each
of your textboxes an InputMask that will accept a single character/digit,
and set its AutoTab property to Yes/True.

Off course! Brilliant and simply! Thanks a lot.
 
For anyone who is listening, this is a classic example of why it's a good
idea to describe *why* you want to do something, as well as saying *what*
you want to do.

If Jesper had simply asked how to call the same parameterized event code
from many different controls, then the answer whould have provided a much
less satisfactory solution.
 
Back
Top