How do I assign shortkeys to text boxes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NickLing
    New Member
    • Dec 2010
    • 1

    How do I assign shortkeys to text boxes?

    I'm trying to assign a shortkey to a text box via a label control adjacent to the text box, but I dont know how link the label to the box. Any suggestions?
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    your idea is not clear.

    I worked on VB around 2 years ago. Cant recall much.

    But I think Label do not receive any Focus. So I think that this is not possible.

    or did you mean you want to assign value of certain text field to label field after pressing certain key while that text box is focused? it is possible Try OnKeyPress or onKeyDown or OnKeyUp action. Do two thing first set the text(text) to label(caption) and then set the value of keycode to zero. It will do

    Comment

    • Deep Gajjar
      New Member
      • Dec 2010
      • 1

      #3
      The Label MUST have the TabIndex Property set to TextBox's TabIndex Property - 1

      Example: If TextBox's TabIndex = 2 then Label's TabIndex must be = 1

      Comment

      • smartchap
        New Member
        • Dec 2007
        • 236

        #4
        Please make the query clear. Do u want to set focus to the adjacent TextBox when Label (adjacent to the textbox) is clicked? Then write code like:
        Code:
        Private Sub Label1_Click()
            Text1.SetFocus
        End Sub
        
        Private Sub Label2_Click()
            Text2.SetFocus
        End Sub

        Comment

        Working...