470,821 Members | 2,041 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,821 developers. It's quick & easy.

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 4139
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Steven T. Hatton | last post: by
27 posts views Thread by Abdullah Kauchali | last post: by
8 posts views Thread by kaosyeti | last post: by
104 posts views Thread by Beowulf | last post: by
54 posts views Thread by Rasjid | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.