VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Numerical input into text box (1 line of code)

by Kenneth Gilbert Jr. (2 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (6 Votes)

With this 1 line of code you can strip non-numerical input into text boxes.

Rate Numerical input into text box (1 line of code)

Private Sub Text1_KeyPress(KeyAscii As Integer)
' Force numbers only in a text box
If IsNumeric(Chr(KeyAscii)) <> True Then KeyAscii = 0
End Sub

Download this snippet    Add to My Saved Code

Numerical input into text box (1 line of code) Comments

No comments have been posted about Numerical input into text box (1 line of code). Why not be the first to post a comment about Numerical input into text box (1 line of code).

Post your comment

Subject:
Message:
0/1000 characters