Code: Select all
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Beep
End If
End Sub
Code: Select all
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case Asc(0) To Asc(9)
Case Asc("-"), Asc("+"), Asc("."), Asc(",")
Case 8, 13 '8 for backspace and 13 for enter
Case Else
KeyAscii = 0
Beep
End Select
End Sub