VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Allow only numbers to be entered in a text box

by Brandon (46 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 25th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Allow only numbers to be entered in a text box

Rate Allow only numbers to be entered in a text box




Private Sub Command1_Click()
'validate data for numbers only
If Not IsNumeric(Text1) Then
    MsgBox "Only numbers are allowed", vbExclamation, "Invalid Data"
    Text1 = ""
    Text1.SetFocus
Else
    MsgBox "The data enter was valid, you may continue", vbInformation + vbOKOnly, "Valid Data"
End If
End Sub

Download this snippet    Add to My Saved Code

Allow only numbers to be entered in a text box Comments

No comments have been posted about Allow only numbers to be entered in a text box. Why not be the first to post a comment about Allow only numbers to be entered in a text box.

Post your comment

Subject:
Message:
0/1000 characters