G
Garry Jones
I am a bit confused about keypress.
I can't quite get this to work, there seems to be a few ways to do this.
What I want to do is
Allow a user to press any number (0123456789) in a text box.
I want to allow them to press backspace as well in that text box.
I want to shut off all other keys. When they have entered a 3 digit
number the focus will move to textbox 2 where I will do the same thing
there.
So, if I am on the right lines...
Private Sub TextBox1_KeyPress(KeyAscii As Integer)
tstinput (keyascii)
End Sub
private sub tstinput
If KeyAscii <> 8 'allow backspace
Then
If Not IsNumeric(Chr$(KeyAscii)) Then
KeyAscii = 0
else
end if
else
end if
end sub
But this does not work, I am missing something here.
And when it is working I can add the length bit and move focus to next
textbox, I am content that I can do that at least. But I can not get the
hang of this keypress.
Any help appreciated.
Garry Jones
I can't quite get this to work, there seems to be a few ways to do this.
What I want to do is
Allow a user to press any number (0123456789) in a text box.
I want to allow them to press backspace as well in that text box.
I want to shut off all other keys. When they have entered a 3 digit
number the focus will move to textbox 2 where I will do the same thing
there.
So, if I am on the right lines...
Private Sub TextBox1_KeyPress(KeyAscii As Integer)
tstinput (keyascii)
End Sub
private sub tstinput
If KeyAscii <> 8 'allow backspace
Then
If Not IsNumeric(Chr$(KeyAscii)) Then
KeyAscii = 0
else
end if
else
end if
end sub
But this does not work, I am missing something here.
And when it is working I can add the length bit and move focus to next
textbox, I am content that I can do that at least. But I can not get the
hang of this keypress.
Any help appreciated.
Garry Jones