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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to sent the cursor from one textbox to another textbox by pressing enter key(in vb we may use keypress event)

how to sent the cursor from one textbox to another textbox by pressing enter key(in vb we may use keypress event)

Scheduled Pinned Locked Moved C#
tutorialcareer
5 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.
  • Z Offline
    Z Offline
    zelane
    wrote on last edited by
    #1

    hi i want to sent the cursor from one textbox to another textbox or button just pressing ENTER key all time. but i am not getting any way so that i can perform this job which i can do very easily in vb just using keypress event and keyenter(keyascii). i will be grateful if somebody sent me this solution zelane

    N 1 Reply Last reply
    0
    • Z zelane

      hi i want to sent the cursor from one textbox to another textbox or button just pressing ENTER key all time. but i am not getting any way so that i can perform this job which i can do very easily in vb just using keypress event and keyenter(keyascii). i will be grateful if somebody sent me this solution zelane

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      1- Handle the TextBox.KeyDown event. 2- In the handler call NextTextBox.Focus() method;

      Regards:rose:

      Z 1 Reply Last reply
      0
      • N Nader Elshehabi

        1- Handle the TextBox.KeyDown event. 2- In the handler call NextTextBox.Focus() method;

        Regards:rose:

        Z Offline
        Z Offline
        zelane
        wrote on last edited by
        #3

        i am new in C# so that can't understand how to get help from your hints. request u to explain a little. showing just two textbox (like textbox1 and textbox2)

        N 1 Reply Last reply
        0
        • Z zelane

          i am new in C# so that can't understand how to get help from your hints. request u to explain a little. showing just two textbox (like textbox1 and textbox2)

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          Alright! I guess atleast you know the PropertiesGrid, right? 1- Select TextBox1. Open PropertiesGrid. Open Events tab -little lightning button to the top-. DoubleClick on KeyDown event. 2- The code should show. Add these lines

          if (e.KeyData == Keys.Enter)
          TextBox2.Focus();

          3- Err... That's it!:-D

          Regards:rose:

          G 1 Reply Last reply
          0
          • N Nader Elshehabi

            Alright! I guess atleast you know the PropertiesGrid, right? 1- Select TextBox1. Open PropertiesGrid. Open Events tab -little lightning button to the top-. DoubleClick on KeyDown event. 2- The code should show. Add these lines

            if (e.KeyData == Keys.Enter)
            TextBox2.Focus();

            3- Err... That's it!:-D

            Regards:rose:

            G Offline
            G Offline
            gnadeem
            wrote on last edited by
            #5

            adding to what Nader said, you can further fine-tune by querying TabStop and TabIndex properties of the text boxes (controls where applicable) and compare TabIndex to dynamically set focus to the control which is next in the TabIndex order. regards.

            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