473,394 Members | 1,893 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,394 software developers and data experts.

tab order

Hi all i am writing a program to validate shipping container numbers.
Basically it gets each letter and number, gives it a value, does a bit of
math and spits out an answer (kinda like basic cd key validation). I
currently have 7 text boxes (one for each character). Everything works but i
dont know how to do the following:

Have a single text box and have it be able to work out each character.
OR
Set it up so that when i press a key it will automatically move the the next
text box. At the moment i have to tab to each box.

I prefer to have seperate text boxes for this app but i would like to learn
both ways of doing it.

thanks
steve
Jul 17 '05 #1
6 4224
Steve,

When the lenght of the textbox is a certain lenght then shift the focus to
another textbox.

Greets John
"steve" <me@home.com> schreef in bericht
news:40***********************@news.optusnet.com.a u...
Hi all i am writing a program to validate shipping container numbers.
Basically it gets each letter and number, gives it a value, does a bit of
math and spits out an answer (kinda like basic cd key validation). I
currently have 7 text boxes (one for each character). Everything works but i dont know how to do the following:

Have a single text box and have it be able to work out each character.
OR
Set it up so that when i press a key it will automatically move the the next text box. At the moment i have to tab to each box.

I prefer to have seperate text boxes for this app but i would like to learn both ways of doing it.

thanks
steve

Jul 17 '05 #2
The single text box approach:

dim intLen as integer, strChar as string*1
dim intCtr as integer, dblCharValues() as double

intLen=len(txtBox.text) 'Get length of Container Number (7?)
'Make sure you validate the value of the text box!

'Reserve memory to hold the char values
redim dblCharValues(1 to intLen)

for intCtr=1 to intLen
'Capture the current char
strChar=mid(txtBox.text,intCtr,1)

'Call a function of your design to assign
'the value to the current char
dblCharValues(intCtr)=AssignValue(strChar)

next intCtr

'Do what ever you need with your array of values.

--Another Steve.
"steve" <me@home.com> wrote in message news:<40***********************@news.optusnet.com. au>...
Hi all i am writing a program to validate shipping container numbers.
Basically it gets each letter and number, gives it a value, does a bit of
math and spits out an answer (kinda like basic cd key validation). I
currently have 7 text boxes (one for each character). Everything works but i
dont know how to do the following:

Have a single text box and have it be able to work out each character.
OR
Set it up so that when i press a key it will automatically move the the next
text box. At the moment i have to tab to each box.

I prefer to have seperate text boxes for this app but i would like to learn
both ways of doing it.

thanks
steve

Jul 17 '05 #3
sorry i am a little bit out of my depth. I was never a big programmer (more
just for fun) and i have not touched it for a while. could you through a
little code my way or a link please?

thanks for your help

steve
"John Lauwers" <no****@fictief.com> wrote in message
news:40***********************@news.skynet.be...
Steve,

When the lenght of the textbox is a certain lenght then shift the focus to
another textbox.

Greets John
"steve" <me@home.com> schreef in bericht
news:40***********************@news.optusnet.com.a u...
Hi all i am writing a program to validate shipping container numbers.
Basically it gets each letter and number, gives it a value, does a bit of math and spits out an answer (kinda like basic cd key validation). I
currently have 7 text boxes (one for each character). Everything works
but i
dont know how to do the following:

Have a single text box and have it be able to work out each character.
OR
Set it up so that when i press a key it will automatically move the the

next
text box. At the moment i have to tab to each box.

I prefer to have seperate text boxes for this app but i would like to

learn
both ways of doing it.

thanks
steve


Jul 17 '05 #4
thanks for your help. as i replied to another person who replied to my post
i am a little out of my depth and have been out of it for a while. I mainly
program for fun (and occasionally for work). Sorry if i seem like a pain,
just trying to get back into some coding (have fogotton way to much)
refer below

"Steve Gdula" <st********@yahoo.com> wrote in message
news:ca**************************@posting.google.c om...
The single text box approach:

dim intLen as integer, strChar as string*1 ' the *1 refers to first character? if so then i would change to *2 for
second and so on? dim intCtr as integer, dblCharValues() as double

intLen=len(txtBox.text) 'Get length of Container Number (7?)
' yes 7
'Make sure you validate the value of the text box!

'Reserve memory to hold the char values
redim dblCharValues(1 to intLen)
'does this save all or just the first character to memory? I am guessing the
first due to the 1 being present

for intCtr=1 to intLen
'Capture the current char
strChar=mid(txtBox.text,intCtr,1)

'Call a function of your design to assign
'the value to the current char
dblCharValues(intCtr)=AssignValue(strChar)
' AssignChar is substituted for a number?

next intCtr

'Do what ever you need with your array of values.

--Another Steve.
"steve" <me@home.com> wrote in message

news:<40***********************@news.optusnet.com. au>...
Hi all i am writing a program to validate shipping container numbers.
Basically it gets each letter and number, gives it a value, does a bit of math and spits out an answer (kinda like basic cd key validation). I
currently have 7 text boxes (one for each character). Everything works but i dont know how to do the following:

Have a single text box and have it be able to work out each character.
OR
Set it up so that when i press a key it will automatically move the the next text box. At the moment i have to tab to each box.

I prefer to have seperate text boxes for this app but i would like to learn both ways of doing it.

thanks
steve

Jul 17 '05 #5
> ' the *1 refers to first character? if so then i would change to *2 for
second and so on?
No, let me explain this:
Dim strValue as string*1 '*1 reserves mem to store 1 character in this variable
Dim strValue2 as string*3 '*3 reserves mem to store up to 3 chars in this variable
( I am only limiting the number of chars this string can hold )
Dim strValue as string 'Dimensioned this way, this variable can hold vast
'numbers of characters
intLen=len(txtBox.text) 'Get length of Container Number (7?)


' yes 7


( The above approach will work for any length of 'Container Num' but if you
have a fixed length you can do that too - best advised to be flexible )
'Reserve memory to hold the char values
redim dblCharValues(1 to intLen)


'does this save all or just the first character to memory? I am guessing the
first due to the 1 being present


' The above saves nothing to memory. It merely sets aside space in memory for
' a number of values that you will assign to each char ( 1 to 7 in your case)
for intCtr=1 to intLen
'Capture the current char
strChar=mid(txtBox.text,intCtr,1)

'Call a function of your design to assign
'the value to the current char
dblCharValues(intCtr)=AssignValue(strChar)


' AssignChar is substituted for a number?


'The variables 'dblCharValues(1 thru 7) are assigned a number by
'a function called 'AssignValue'. 'AssignValue' is a function
'or possibly a number of lines of code directly in this for-next
'loop that assigns the value you have pre-determined to match the
'current char you have extracted.

next intCtr

'Do what ever you need with your array of values.

--Another Steve.


Quicky explanation of 'Mid' function:
mid("ABC123",1,1) yields--> "A" mid("ABC123",2,1) yields--> "B"
mid("ABC123",5,1)yields--> "2" mid("ABC123",2,3) yields --> "BC1"

I have made everything as clear as possible. If you still do not
get the syntax or approach then it may be time to get an introductory
VB language book.

Good Luck,

Steve.
Jul 17 '05 #6
thanks for your help. I have got a vb book here so i will get reading on
that as well

THANKS!!
"Steve Gdula" <st********@yahoo.com> wrote in message
news:ca**************************@posting.google.c om...
' the *1 refers to first character? if so then i would change to *2 for
second and so on?
No, let me explain this:
Dim strValue as string*1 '*1 reserves mem to store 1 character in this

variable Dim strValue2 as string*3 '*3 reserves mem to store up to 3 chars in this variable ( I am only limiting the number of chars this string can hold )
Dim strValue as string 'Dimensioned this way, this variable can hold vast
'numbers of characters
intLen=len(txtBox.text) 'Get length of Container Number (7?)
' yes 7


( The above approach will work for any length of 'Container Num' but if

you have a fixed length you can do that too - best advised to be flexible )
'Reserve memory to hold the char values
redim dblCharValues(1 to intLen)
'does this save all or just the first character to memory? I am guessing the
first due to the 1 being present


' The above saves nothing to memory. It merely sets aside space in memory

for ' a number of values that you will assign to each char ( 1 to 7 in your case) for intCtr=1 to intLen
'Capture the current char
strChar=mid(txtBox.text,intCtr,1)

'Call a function of your design to assign
'the value to the current char
dblCharValues(intCtr)=AssignValue(strChar)


' AssignChar is substituted for a number?


'The variables 'dblCharValues(1 thru 7) are assigned a number by
'a function called 'AssignValue'. 'AssignValue' is a function
'or possibly a number of lines of code directly in this for-next
'loop that assigns the value you have pre-determined to match the
'current char you have extracted.

next intCtr

'Do what ever you need with your array of values.

--Another Steve.


Quicky explanation of 'Mid' function:
mid("ABC123",1,1) yields--> "A" mid("ABC123",2,1) yields--> "B"
mid("ABC123",5,1)yields--> "2" mid("ABC123",2,3) yields --> "BC1"

I have made everything as clear as possible. If you still do not
get the syntax or approach then it may be time to get an introductory
VB language book.

Good Luck,

Steve.

Jul 17 '05 #7

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

Similar topics

7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
9
by: Steven T. Hatton | last post by:
The following works: template <typename T> struct ID3M{ static const T ID; }; template <typename T> const T ID3M<T>::ID = {{1,0,0},{0,1,0},{0,0,1}};
15
by: | last post by:
The data file is a simple Unicode file with lines of text. BCP apparently doesn't guarantee this ordering, and neither does the import tool. I want to be able to load the data either sequentially...
27
by: Abdullah Kauchali | last post by:
Hi folks, Can one rely on the order of keys inserted into an associative Javascript array? For example: var o = new Object(); o = "Adam"; o = "Eve";
8
by: kaosyeti | last post by:
i have a (hopefully) small problem. i have created a system where a user enters customer information into a table through a form. this table has no primary key. there are 9 fields on the form to...
104
by: Beowulf | last post by:
I have the view below and if I use vwRouteReference as the rowsource for a combo box in an MS Access form or run "SELECT * FROM vwRouteReference" in SQL Query Analyzer, the rows don't come through...
13
by: bevanward | last post by:
Hi All I am finding unexpected results when inserted into a newly created table that has a field of datatype int identity (1,1). Basically the order I sort on when inserting into the table is...
3
by: Hartmut Dippon | last post by:
Hi all, I hope somebody can help me with following problem: I have an application where I can drag&drop files/dirs from within explorer onto my form. If multiple files/dirs are selected I...
54
by: Rasjid | last post by:
Hello, I have just joined and this is my first post. I have never been able to resolve the issue of order of evaluation in C/C++ and the related issue of precedence of operators, use of...
25
by: DanicaDear | last post by:
Hello again Bytes...I missed you! First, background: In a hotstick lab, we ship orders every two years. We ship a new order and the customer uses the new box to return the previous year's order....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.