Discussion:
VB newbie help
(too old to reply)
Steve
2003-09-17 10:51:18 UTC
Permalink
Hi all i am writing a small program and what i need to do is have some code
that will do the following:

When i press a key within a text box it will type that letter/number in
and then move to the next text box in the tab order.

any help appreciated

steve
Kerberoz
2003-09-17 11:50:05 UTC
Permalink
Post by Steve
Hi all i am writing a small program and what i need to do is have some code
When i press a key within a text box it will type that letter/number in
and then move to the next text box in the tab order.
any help appreciated
steve
This is not a real solution, but maybe it can help you.
If you work with textbox-arrays (copy/paste one), you can use this code,
only one problem, when you get to the last, you get an error ofcourse,
because there's no next one. I was looking for a way to trap it, but I think
it's not possible.


Private Sub Text1_Change(Index As Integer)
Text1(Index + 1).SetFocus
End Sub
Stephane Richard
2003-09-17 12:01:02 UTC
Permalink
in teh keypress event of your textbox

if you use a control array (where all your text boxes are named the same
then...for example:
If len(trim(text1(Index).Text) = 1 then 'Test if there's a character in
the textbox
KeyAscii = 0
sendkeys "{TAB}" ' by sending this keystroke, it wil simulate
tabbing.
endif

if you dont use a control array for your text box you can put this code in
each text box changing text1(Index).Text to <TextBoxName>.Text accordingly.
--
Stéphane Richard
Senior Software and Technology Supervisor
http://www.totalweb-inc.com
For all your hosting and related needs
Post by Steve
Hi all i am writing a small program and what i need to do is have some code
When i press a key within a text box it will type that letter/number in
and then move to the next text box in the tab order.
any help appreciated
steve
Continue reading on narkive:
Loading...