Results 1 to 7 of 7

Thread: Can Any One Tell Me How to use Enter Key Instead of Tab key?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Location
    Pune
    Posts
    8

    Can Any One Tell Me How to use Enter Key Instead of Tab key?

    Hello,

    I am having number of textfields and mask edit boxes on the form.
    Instead of using TAB key to go from one text field to another i wanted to use Enter key.
    If any body know how to do this, pl tell me.

    If any further clarification is required let me know.

    Veeru
    [email protected]

  2. #2
    Lively Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    105
    Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    SendKeys "{tab}"
    End If
    End Sub

    Private Sub Form_Load()
    Me.KeyPreview = True
    End Sub
    Shahab Ahmed

  3. #3
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Use the KeyDown method of the textbox to detect the Enter key being pressed, then use the SetFocus method on the textbox you want to move to.

    This will all be very easy if you've used a control array of text boxes.

    Tris.
    This world is not my home. I'm just passing through.

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Location
    Pune
    Posts
    8
    I Tried using the above code but one problem is there my keyboard gets locks why i dont know. if i remove the code it works well.

  5. #5
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Were you replying to me or shahab?

    Whichever, try this project.

    Tris.
    Attached Files Attached Files
    This world is not my home. I'm just passing through.

  6. #6
    jnielsen
    Guest
    Originally posted by veeru
    I Tried using the above code but one problem is there my keyboard gets locks why i dont know. if i remove the code it works well.
    I've had the same problem in the past, check out this KB artical for a solution.

    SendKeys Problem

  7. #7
    Lively Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    105
    Well the code is working perfectly allright, u can refer to microsoft support mentioned by jnielsen. Thanx jnielsen.
    Shahab Ahmed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width