Allow only numbers in a textbox
This program won't allow any other characters in a textbox then numbers and it allows you to use your Backspace key.
Rate Allow only numbers in a textbox
(6(6 Vote))
Private Sub text1_KeyPress(KeyAscii As Integer)
Dim Numbers As Integer
Dim Msg As String
Numbers = KeyAscii
If ((Numbers < 48 Or Numbers > 57) And Numbers <> 8) Then
Msg = MsgBox("Only Numbers are aloud in this Textbox", vbCritical, "Error Number")
KeyAscii = 0
End If
End Sub
Allow only numbers in a textbox Comments
No comments yet — be the first to post one!
Post a Comment