Click to See Complete Forum and Search --> : VbReturnKey


usin
October 18th, 2000, 06:36 AM
is it possible to filter the keyboard to accept only numeric at the same time traping the vbreturnkey

for example:

Private Sub Text1_Keyup(Keycode As Integer, shift As Integer)
Dim lstitem As ListItem
If Keycode = vbKeyReturn Then SendKeys "{tab}"

end sub

thanks for any help.
usin

Lothar Haensler
October 18th, 2000, 07:15 AM
in order to trap Returns trap the KeyPress event and query the KeyAscii parameter for vbKeyReturn

usin
October 18th, 2000, 10:41 AM
thanks for your reply,
i tried to make the text2 respond to uparrowkey which is, when the uparrowkey is press the cursor will go up to the previous text1. can you help me solve this problem? the following code is not working for uparrowkey



Private Sub text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Or KeyAscii = 13 Then 'you can press backspace and enter (search the ascii code for enter key cannot find it now)
SendKeys "{tab}"
End If

If KeyAscii < 48 Or KeyAscii > 57 Then
Beep
KeyAscii = 0
End If

End Sub


Private Sub text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Or KeyAscii = 13 Then 'you can press backspace and enter (search the ascii code for enter key cannot find it now)
SendKeys "{tab}"
End If

If KeyAscii < 48 Or KeyAscii > 57 Then
Beep
KeyAscii = 0
End If

If KeyAscii = vbKeyUp Then SendKeys "+{tab}"

End Sub

Dr_Michael
October 18th, 2000, 10:59 AM
If KeyAscii = vbKeyUp then text1.setfocus



:-)

Michael Vlastos
Automation Engineer
Intracom, Research & Development Division
Development Programmes Department
Athens, Greece