tab order

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • steve

    #1

    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


  • John Lauwers

    #2
    Re: tab order

    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:40347204$0 $14898$afc38c87 @news.optusnet. com.au...[color=blue]
    > 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[/color]
    i[color=blue]
    > 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[/color]
    next[color=blue]
    > 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[/color]
    learn[color=blue]
    > both ways of doing it.
    >
    > thanks
    > steve
    >
    >[/color]


    Comment

    • Steve Gdula

      #3
      Re: tab order

      The single text box approach:

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

      intLen=len(txtB ox.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(txt Box.text,intCtr ,1)

      'Call a function of your design to assign
      'the value to the current char
      dblCharValues(i ntCtr)=AssignVa lue(strChar)

      next intCtr

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

      --Another Steve.


      "steve" <me@home.com> wrote in message news:<40347204$ 0$14898$afc38c8 7@news.optusnet .com.au>...[color=blue]
      > 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[/color]

      Comment

      • steve

        #4
        Re: tab order

        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" <nobody@fictief .com> wrote in message
        news:4034815c$0 $13257$ba620e4c @news.skynet.be ...[color=blue]
        > 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:40347204$0 $14898$afc38c87 @news.optusnet. com.au...[color=green]
        > > 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[/color][/color]
        of[color=blue][color=green]
        > > math and spits out an answer (kinda like basic cd key validation). I
        > > currently have 7 text boxes (one for each character). Everything works[/color][/color]
        but[color=blue]
        > i[color=green]
        > > 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[/color]
        > next[color=green]
        > > 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[/color]
        > learn[color=green]
        > > both ways of doing it.
        > >
        > > thanks
        > > steve
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • steve

          #5
          Re: tab order

          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" <stevegdula@yah oo.com> wrote in message
          news:cae000cd.0 402190936.360ea 469@posting.goo gle.com...[color=blue]
          > The single text box approach:
          >
          > dim intLen as integer, strChar as string*1[/color]
          ' the *1 refers to first character? if so then i would change to *2 for
          second and so on?[color=blue]
          > dim intCtr as integer, dblCharValues() as double
          >
          > intLen=len(txtB ox.text) 'Get length of Container Number (7?)[/color]

          ' yes 7
          [color=blue]
          > 'Make sure you validate the value of the text box!
          >
          > 'Reserve memory to hold the char values
          > redim dblCharValues(1 to intLen)[/color]

          'does this save all or just the first character to memory? I am guessing the
          first due to the 1 being present
          [color=blue]
          >
          > for intCtr=1 to intLen
          > 'Capture the current char
          > strChar=mid(txt Box.text,intCtr ,1)
          >
          > 'Call a function of your design to assign
          > 'the value to the current char
          > dblCharValues(i ntCtr)=AssignVa lue(strChar)[/color]

          ' AssignChar is substituted for a number?
          [color=blue]
          >
          > next intCtr
          >
          > 'Do what ever you need with your array of values.
          >
          > --Another Steve.
          >
          >
          > "steve" <me@home.com> wrote in message[/color]
          news:<40347204$ 0$14898$afc38c8 7@news.optusnet .com.au>...[color=blue][color=green]
          > > 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[/color][/color]
          of[color=blue][color=green]
          > > math and spits out an answer (kinda like basic cd key validation). I
          > > currently have 7 text boxes (one for each character). Everything works[/color][/color]
          but i[color=blue][color=green]
          > > 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[/color][/color]
          next[color=blue][color=green]
          > > 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[/color][/color]
          learn[color=blue][color=green]
          > > both ways of doing it.
          > >
          > > thanks
          > > steve[/color][/color]


          Comment

          • Steve Gdula

            #6
            Re: tab order

            > ' the *1 refers to first character? if so then i would change to *2 for[color=blue]
            > second and so on?[/color]

            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
            [color=blue][color=green]
            > > intLen=len(txtB ox.text) 'Get length of Container Number (7?)[/color]
            >
            > ' yes 7[/color]

            ( 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 )
            [color=blue][color=green]
            > > 'Reserve memory to hold the char values
            > > redim dblCharValues(1 to intLen)[/color]
            >
            > 'does this save all or just the first character to memory? I am guessing the
            > first due to the 1 being present[/color]

            ' 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)
            [color=blue][color=green]
            > > for intCtr=1 to intLen
            > > 'Capture the current char
            > > strChar=mid(txt Box.text,intCtr ,1)
            > >
            > > 'Call a function of your design to assign
            > > 'the value to the current char
            > > dblCharValues(i ntCtr)=AssignVa lue(strChar)[/color]
            >
            > ' AssignChar is substituted for a number?[/color]

            '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.
            [color=blue]
            >[color=green]
            > >
            > > next intCtr
            > >
            > > 'Do what ever you need with your array of values.
            > >
            > > --Another Steve.[/color][/color]

            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.

            Comment

            • steve

              #7
              Re: tab order

              thanks for your help. I have got a vb book here so i will get reading on
              that as well

              THANKS!!


              "Steve Gdula" <stevegdula@yah oo.com> wrote in message
              news:cae000cd.0 402200846.7dccf b47@posting.goo gle.com...[color=blue][color=green]
              > > ' the *1 refers to first character? if so then i would change to *2 for
              > > second and so on?[/color]
              >
              > No, let me explain this:
              > Dim strValue as string*1 '*1 reserves mem to store 1 character in this[/color]
              variable[color=blue]
              > Dim strValue2 as string*3 '*3 reserves mem to store up to 3 chars in this[/color]
              variable[color=blue]
              > ( 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
              >[color=green][color=darkred]
              > > > intLen=len(txtB ox.text) 'Get length of Container Number (7?)[/color]
              > >
              > > ' yes 7[/color]
              >
              > ( The above approach will work for any length of 'Container Num' but if[/color]
              you[color=blue]
              > have a fixed length you can do that too - best advised to be flexible )
              >[color=green][color=darkred]
              > > > 'Reserve memory to hold the char values
              > > > redim dblCharValues(1 to intLen)[/color]
              > >
              > > 'does this save all or just the first character to memory? I am guessing[/color][/color]
              the[color=blue][color=green]
              > > first due to the 1 being present[/color]
              >
              > ' The above saves nothing to memory. It merely sets aside space in memory[/color]
              for[color=blue]
              > ' a number of values that you will assign to each char ( 1 to 7 in your[/color]
              case)[color=blue]
              >[color=green][color=darkred]
              > > > for intCtr=1 to intLen
              > > > 'Capture the current char
              > > > strChar=mid(txt Box.text,intCtr ,1)
              > > >
              > > > 'Call a function of your design to assign
              > > > 'the value to the current char
              > > > dblCharValues(i ntCtr)=AssignVa lue(strChar)[/color]
              > >
              > > ' AssignChar is substituted for a number?[/color]
              >
              > '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.
              >[color=green]
              > >[color=darkred]
              > > >
              > > > next intCtr
              > > >
              > > > 'Do what ever you need with your array of values.
              > > >
              > > > --Another Steve.[/color][/color]
              >
              > 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.[/color]


              Comment

              Working...