C# :How to change the focus of Textbox control for Enter key pressed?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • senthilnova
    New Member
    • Nov 2007
    • 7

    C# :How to change the focus of Textbox control for Enter key pressed?

    hi
    i have many textbox controls in a form, i want to navigate to other textboxes when
    ENTER key is pressed .
    can any one help me.

    thanks
    ssk
  • PareshRathod
    New Member
    • Mar 2007
    • 28

    #2
    Hello,

    In the keydown event of that textbox write down following code

    Code:
    If e.KeyData = Keys.Enter Then
                SendKeys.Send("{TAB}")
    End If
    Dont't forget to set tab index of the textboxes you have in your form...

    Hope this will help you..

    Paresh

    Originally posted by senthilnova
    hi
    i have many textbox controls in a form, i want to navigate to other textboxes when
    ENTER key is pressed .
    can any one help me.

    thanks
    ssk

    Comment

    • senthilnova
      New Member
      • Nov 2007
      • 7

      #3
      HI Paresh

      thank u for answering me,
      I did as u said , but it shows an error as below, also i had set the Tabindex property for that textbox .

      Error Msg: Cannot assign to 'Send' because it is a 'method group'.

      how to solve this?

      thank u
      ssk






      Originally posted by PareshRathod
      Hello,

      In the keydown event of that textbox write down following code

      Code:
      If e.KeyData = Keys.Enter Then
                  SendKeys.Send("{TAB}")
      End If
      Dont't forget to set tab index of the textboxes you have in your form...

      Hope this will help you..

      Paresh

      Comment

      • PareshRathod
        New Member
        • Mar 2007
        • 28

        #4
        Hi,

        Can you please copy and paste your code for sending key..
        That will help me to answer you..

        Paresh

        Originally posted by senthilnova
        HI Paresh

        thank u for answering me,
        I did as u said , but it shows an error as below, also i had set the Tabindex property for that textbox .

        Error Msg: Cannot assign to 'Send' because it is a 'method group'.

        how to solve this?

        thank u
        ssk

        Comment

        Working...