Pyrgos
New Member
- Joined
- Feb 22, 2012
- Messages
- 30
Hello there,
I have the following code on an ActiveX Listbox stating that if I press Shift+Tab, a Textbox will be activated. The trouble is, it won't activate, and I find it very weird. SetFocus is not possible to use. Here is the code:
If I take the Tab key from the code and set the condition to activate the textbox in case of pressing the Shift key only, then txtSearch will be activated successfully:
Setting the TAB key only instead of Shift+TAB has the same result.
Any ideas on how can I get this working?
Thank you in advance.
I have the following code on an ActiveX Listbox stating that if I press Shift+Tab, a Textbox will be activated. The trouble is, it won't activate, and I find it very weird. SetFocus is not possible to use. Here is the code:
Code:
Private Sub lstSearch_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
txtSearch.Activate
Call DoTheMagic(lstSearch.List(0))
ElseIf Shift = 1 And KeyCode = vbKeyTab Then
lstSearch.Selected(0) = False
txtSearch.Activate ‘IT DOES NOT ACTIVATE, IT ONLY DESELECTS THE LISTBOX
End If
End Sub
If I take the Tab key from the code and set the condition to activate the textbox in case of pressing the Shift key only, then txtSearch will be activated successfully:
Code:
Private Sub lstSearch_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
txtSearch.Activate
Call DoSteamMagic(lstSearch.List(0))
ElseIf Shift = 1 Then
lstSearch.Selected(0) = False
txtSearch.Activate ‘IT WILL ACTIVATE WITH SUCCESS
End If
End Sub
Setting the TAB key only instead of Shift+TAB has the same result.
Any ideas on how can I get this working?
Thank you in advance.