Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

make ENTER key act like TAB key

apenticoffapenticoff Posts: 63Member
Is there a simple way to make the ENTER key act just like the user pressed the TAB key? I have searched but not found a simple solution yet. Thanx, Art

Comments

  • GogiGogi Posts: 258Member
    : Is there a simple way to make the ENTER key act just like the user pressed the TAB key? I have searched but not found a simple solution yet. Thanx, Art
    :


    Yes,there is a way. ;-)

    Set KeyPreview property of your Form to True.
    And use this code for your Form_KeyDown event:

    [code]
    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    If e.KeyCode = Keys.Return Then
    SendKeys.Send("{TAB}")
    End If
    End Sub
    [/code]

    Hope this helps!
  • apenticoffapenticoff Posts: 63Member
    : : Is there a simple way to make the ENTER key act just like the user pressed the TAB key? I have searched but not found a simple solution yet. Thanx, Art
    : :
    :
    :
    : Yes,there is a way. ;-)
    :
    : Set KeyPreview property of your Form to True.
    : And use this code for your Form_KeyDown event:
    :
    : [code]
    : Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    : If e.KeyCode = Keys.Return Then
    : SendKeys.Send("{TAB}")
    : End If
    : End Sub
    : [/code]
    :
    : Hope this helps!
    :
    You da man! Thanks a bunch. It took 2 minutes to load and run your code. Worked perfectly. I had spent hours looking for the answer. Thanks, Art
Sign In or Register to comment.