473,385 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

text boxes

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
Jul 17 '05 #1
3 7709
Steve wrote:
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


Use KeyPress evet on textbox...

By WhiteRavenEye

Jul 17 '05 #2
As per WhiteRavenEye,
trap the KeyPress event.
What he didn't say is that in this event you should call the SetFocus
method of the next textbox you want to move to.

The easiest way is to have all the textboxes in a nice array.
This way you can use the index parameter to keep track of which
textbox you are in and want to move to

For example

Sub TextBox_KeyPress(Index As Integer, KeyAscii As Integer)
' Assume you have textboxes from TextBox(0) to TextBox(30)
If Index < 30 Then
' set focus to next textbox
TextBox(Index + 1).SetFocus
Else
' set focus back to first textbox
' - or take other action if desired
TextBox(0).SetFocus
End If
End Sub
I hope this is helpful to you.
-----

* * Please include a copy of this note with your reply

Jeff Bennett President
Je**@Bennet-Tec.Com

Bennet-Tec Information Systems, Inc
50 Jericho Tpk, Jericho, NY 11753
Phone 516 997 5596, Fax - 5597
WWW.Bennet-Tec.Com

RELIABLE Component Software
and Software Development Services
* TList/Pro * ALLText HT/Pro * MetaDraw *

====================== ======================
Steve wrote:
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.
WhiteRavenEye wrote

Use KeyPress evet on textbox...

By WhiteRavenEye

Jul 17 '05 #3
> What he didn't say is that in this event you should call the SetFocus
method of the next textbox you want to move to.

The easiest way is to have all the textboxes in a nice array.
This way you can use the index parameter to keep track of which
textbox you are in and want to move to

For example

Sub TextBox_KeyPress(Index As Integer, KeyAscii As Integer)
' Assume you have textboxes from TextBox(0) to TextBox(30)


If you make this change to the If statement, then you won't have to know the
number of TextBox'es in advance.

Sub TextBox_KeyPress(Index As Integer, KeyAscii As Integer)
If Index < TextBox.UBound Then
' set focus to next textbox
TextBox(Index + 1).SetFocus
Else
' set focus back to first textbox
' - or take other action if desired
TextBox(0).SetFocus
End If
End Sub

Rick - MVP
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
7
by: Gertjan van Heijst | last post by:
Hi, I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store...
2
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
2
by: Gary | last post by:
Hello All, I have an editable data grid in my web form, this grid allows the user to add new records, edit existing records and also delete them. When a user adds a record the grid goes in to...
11
by: Edson Peacock | last post by:
I have a report with sub reports, one of the subreports have 12 text boxes that are 2" high and I want them all to grow if one goes to 3" high. If anyone has any suggestions they are very much...
6
by: BurntWithTime | last post by:
Hello everyone, Please can anyone tell me if it is possible for a VB.NET application to check a database and then create textboxes on a form that correspond to those records on the database? For...
4
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I have created a report. This report needs to display records between two dates entered by the user. I put two text boxes on the report so I can enter the start and end date - I set them to use an...
6
by: =?Utf-8?B?Sm9obiBBdXN0aW4=?= | last post by:
I have an app that displays about 20 items of data in text boxes. Very occasionally I need to allow these to be used for data entry, but the bulk of the time they are solely for information. They...
6
by: noe1818 via AccessMonster.com | last post by:
Just a quick question about lines: Is it possible to connect a text box (e.g. txtbx1 to txtbx2 and txtbx2 to txtbx3) with lines where txtbx1,2,&3 move up or down according to their values? Like...
11
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.