Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
For Index = Text1.LBound To Text1.UBound
If (Not (IsNumeric(Text1(Index).Text))) Then
MsgBox "Not numeric"
Exit Sub
Text1(Index).SetFocus
Else
'when it is numeric, do something cool
End If
Next
End Sub
Sub Textbox1_KeyPress (index as integer,keyascii as integer)
If KeyAscii = 8 then exit function ' Backspace
If Not(Chr(KeyAscii) < "0" or Chr(KeyAscii) > "9") Then
keyascii = 0
End if
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.