Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to make cursor jump to the next text field

How to make cursor jump to the next text field

Scheduled Pinned Locked Moved C#
csharpvisual-studiohelptutoriallearning
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ahchoo
    wrote on last edited by
    #1

    Hi, I'd like to make a cursor jump to the next text field when a user reach to the max length of the other in C# .Net. Ex: when you enter the key code for software installation, the cursor keeps go to the next text field without using the tab button. I'm a beginner for VS. Please help thanks. Kyah:doh:

    R S A 3 Replies Last reply
    0
    • A ahchoo

      Hi, I'd like to make a cursor jump to the next text field when a user reach to the max length of the other in C# .Net. Ex: when you enter the key code for software installation, the cursor keeps go to the next text field without using the tab button. I'm a beginner for VS. Please help thanks. Kyah:doh:

      R Offline
      R Offline
      Roy Heil
      wrote on last edited by
      #2

      Step 1. On the form, set the KeyPreview property to true. Step 2. Make sure that the TabIndex is correct for each TextBox that will have this feature. Step 3. Add a KeyUp event for each of the TextBox controls. You can make one function, and assign the same function to each of the TextBox controls. Note that in my example, I have have named my function SSNTextBox_KeyUp. In my program, I have three Textbox controls, used for entering a Social Security number. Step 4. Write the KeyUp event function as follows: private void SSNTextBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if (((TextBox)sender).Text.Length == ((TextBox)sender).MaxLength) { SendKeys.Send("{TAB}"); } } I hope this helps. Roy. -- modified at 21:42 Thursday 9th March, 2006

      1 Reply Last reply
      0
      • A ahchoo

        Hi, I'd like to make a cursor jump to the next text field when a user reach to the max length of the other in C# .Net. Ex: when you enter the key code for software installation, the cursor keeps go to the next text field without using the tab button. I'm a beginner for VS. Please help thanks. Kyah:doh:

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        Instead of using the SendKeys.Send method as suggested by Roy you can and in my opinion should use the Control.SelectNextControl method[^].


        www.troschuetz.de

        1 Reply Last reply
        0
        • A ahchoo

          Hi, I'd like to make a cursor jump to the next text field when a user reach to the max length of the other in C# .Net. Ex: when you enter the key code for software installation, the cursor keeps go to the next text field without using the tab button. I'm a beginner for VS. Please help thanks. Kyah:doh:

          A Offline
          A Offline
          ahchoo
          wrote on last edited by
          #4

          Thanks Roy and Stefan for your help. Kyah :-D

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups