VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Restricting text boxes to numeric text only

by TJ Shreves (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 13th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Restricting text boxes to numeric text only

API Declarations


I found that the "backspace" method froze my program quiet often, so I modified it to read a little differently.
How this works is quiet simple. It states that if a non-numeric text is entered, then the text box will read as whatever is in the quotations(""). So if the quotations("") are left empty as shown, then the text box will read as as if the text box were cleared. It has the same effect as the "backspace" method, just more addaptable. You could enter a phrase or comment in the quotations to advice the user to use numeric text only, ie.("numeric text only").

Rate Restricting text boxes to numeric text only



  If Not IsNumeric(Text1.Text) Then Text1.Text = ""
End Sub

Download this snippet    Add to My Saved Code

Restricting text boxes to numeric text only Comments

No comments have been posted about Restricting text boxes to numeric text only. Why not be the first to post a comment about Restricting text boxes to numeric text only.

Post your comment

Subject:
Message:
0/1000 characters