Try this:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
' These are acceptable keystrokes
Case Else
' These are unacceptable, and should be ignored
KeyAscii = 0
End Select
End Sub
The numbers 48 to 57 are the ascii values of the numbers 0 to 9
more characters can be added.
i.e. 12,48 to 57,65,69 etc
Either single numbers or groups.
Pg
purplegerbil
Junior Poster in Training
78 posts since Apr 2005
Reputation Points: 24
Solved Threads: 6
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
' These are acceptable keystrokes
Case 8
Case Else
' These are unacceptable, and should be ignored
KeyAscii = 0
End Select
End Sub
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215