Results 1 to 2 of 2

Thread: using "up" ,"down" key to move the focus

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    5
    Hi all

    I meet a problem when I am writing a vb program which is about creating database. The input interface of this problem which include many textboxs. I want to know the way that how can i move the focus from textbox to textbox using the "up" and "down" key. Thank you!!

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    Add 2 textboxes to your form and copy the following code:

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyDown Then
    Text2.SetFocus
    End If
    End Sub


    Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyUp Then
    Text1.SetFocus
    End If
    End Sub

    Hope this helps
    TheBao

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