Keep text box focus

Trogdor

Registered User.
Local time
Tomorrow, 09:39
Joined
Oct 22, 2008
Messages
32
Hey people,

I am hoping that there is a simple fix for this problem but...

I have a text box that I need to put notes into, but I am also have buttons on my form with hotkeys associated to them.

When I put notes in my textbox and I press a key that corresponds to a button event then that button is also being fired.

I know it will have something to do with the text box got focus attribute, but i don't know what to put in there.

Cheers
 
No need to worry people :)

I put a wrap around the form_keydown sub.

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If TypeOf Me.ActiveControl Is TextBox Then
Else
Select Case KeyCode
        
        Case vbKeyW
                Call chkWait_Click
                
        Case vbKeyS
                Call btnSearch_Click
                
        Case vbKeyB
                Call btnBlooper_Click
                
        Case vbKeyL
                Call btnLentils_Click
        Case Else:
        
End Select
End If
        
End Sub

If people have better solutions though please let me know :)
 

Users who are viewing this thread

Back
Top Bottom