![]() |
Distinguish between '<' and '.' with KeyUp?
I'm trying to capture key presses in a text control on a form and need
to use KeyUp event (vs. Keypress) so I can capture the arrow keys. It doesn't appear that KeyUp distinguishes between '<' and ',' (since they are both the same key on the keyboard). Am I missing something? Is there some event that captures arrow keys AND would distinguish between '<' and ','? Thanks. John |
Distinguish between '<' and '.' with KeyUp?
Maybe I'm missing something (I'm a bit rusty), but this works for me in
Excel XP: Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Select Case KeyCode Case 37 MsgBox "Left" Case 38 MsgBox "Up" Case 39 MsgBox "Right" Case 40 MsgBox "Down" Case 188 If Shift = 0 Then MsgBox "Comma" Else MsgBox "Less than" End If Case Else End Select End Sub __________________________________________________ _______________________ "robotman" wrote in message oups.com... I'm trying to capture key presses in a text control on a form and need to use KeyUp event (vs. Keypress) so I can capture the arrow keys. It doesn't appear that KeyUp distinguishes between '<' and ',' (since they are both the same key on the keyboard). Am I missing something? Is there some event that captures arrow keys AND would distinguish between '<' and ','? Thanks. John |
Distinguish between '<' and '.' with KeyUp?
One piece of information that I didn't mention is that the characters
are actually coming from a piece of equipment through a keyboard wedge so there aren't any physical keys being pressed. I was assuming that the KeyUp wouldn't intrepet the "Shift" correctly (since it wasn't actually being pressed), but your code does work. I guess the event looks first at the ASCII it has received and then assigns the SHIFT value and assigns the keycode based on the ASCII. It's interesting that when it receives a "<" from the instrument, it triggers the event twice... once for the ',' and then again for the virtual shift release. Thanks for your help. John |
All times are GMT +1. The time now is 07:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com