Results 1 to 4 of 4

Thread: Enter Key ( Key Press )

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108

    Cool

    Hi...

    How to move cursor using Enter Key ( Key Press )from field to field.

  2. #2
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    'Try this code
    'Assuming that you have an array of text boxes named txtCtl

    Sub txtCtl_Keypress(Index as Integer, KeyAscii as Integer)
    If KeyAscii = 13 And Index < txtCtl.Count - 1 Then
    txtCtl(Index + 1).SetFocus
    End If
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108

    Cool

    Thanks for your response...

    And how if i've an array Text Box and Combo Box.

  4. #4
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Try this:

    -------------------------------------------------

    Sub ChangeFocus(KeyAscii as Integer)
    If KeyAscii = 13 Then SendKeys "{TAB}"
    End Sub

    -------------------------------------------------

    You can use the ChangeFocus sub procedure by calling it from the KeyPress event of any control. You have to pass KeyAscii to this procedure.

    For example:

    -------------------------------------------------

    Sub txtEmployeeId_KeyPress(KeyAscii As Integer)

    ChangeFocus KeyAscii

    End Sub

    -------------------------------------------------

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