472,779 Members | 2,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 7681
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...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.