Text from one textbox to the other

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Docarctiss
    New Member
    • Nov 2008
    • 7

    #1

    Text from one textbox to the other

    Hello peeps,

    does anyone have a code snippet, to get the text running from one textbox into another?

    eg.

    txtBox 1 = 2 characters
    txtBox 2 = 6 characters

    total text = pilotfine

    but as soon as i get to the end off txtBox 1 and press letter "L" it beeps instead of moving over to the txtBox 2 and if i press letter "L" again then only does it go over to txtBox 2.

    Hope this post is not to wierd or confusing.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Congratulations ! You have just won the WPOTDC(*), stay tuned for details.

    Are you talking about changing focus from one textbox to another or copying text from one textbox to another?

    (*) Weirdest post of the day contest.

    Comment

    • Docarctiss
      New Member
      • Nov 2008
      • 7

      #3
      As you type in the needed text in must first insert the 2 characters in the first txtBox then the rest in the second txtBox, So ja i think change focus :P

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Why would you want to do that? Rather limit the first textbox to two characters only. Then when the user has entered the two characters, they can move to the next textbox and enter the rest of the text.

        If you want to continue with your other (weird) approach, you can put a key typed (or pressed not sure which one) on the first textbox. The event does nothing when there are less than two characters. After two characters are reached, it then removes whatever has been typed and appends it to the second textbox.

        Comment

        • Docarctiss
          New Member
          • Nov 2008
          • 7

          #5
          I hear what you are saying, Let me be a little clearer.
          I am obviously a junior developer so please bare with me :D

          i need to enter coordinates that will be used to locate an area on a map.
          i have a dot after the first two integers, so i want to enter the first to values then the Focus must move to the next text box. i separated the the coordinates with the two text boxes to have a dot txtLable in between. This is the way i was told to do it.

          thanks for all the quick responses.

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            OK then, that's easy enough. So in your first textbox1's TextChanged event, you
            do something like this
            Code:
            string text = textBox1.Text;
            if(text.Length == 2) {
               textBox2.Focus();
            }

            Comment

            • Docarctiss
              New Member
              • Nov 2008
              • 7

              #7
              Yes that did it thanks a lot, i was not sure which event i was supposed to use.
              Anyhow thanks for the help and enjoy the rest of the day.........
              after all it is FRIDAY BABEEEE

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by Docarctiss
                Y..
                after all it is FRIDAY BABEEEE
                Yes, if Mary had not recovered from her flu and come back we'd all be having a party today.

                Comment

                Working...