VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



TextBox that accepts only 1.numeric value 2.backspace 3.single decimal

by Dharam Bahadur Gharti (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 22nd March 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

TextBox that accepts only 1.numeric value 2.backspace 3.single decimal

Rate TextBox that accepts only 1.numeric value 2.backspace 3.single decimal



            Text1.Text = " "
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
            If KeyAscii = vbKeyBack Then Exit Sub
            If KeyAscii = Asc(".") And InStr(1, Text1.Text, ".") = 0 Then
               KeyAscii = Asc(".")
               Exit Sub
            End If
          If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
            
End Sub


Download this snippet    Add to My Saved Code

TextBox that accepts only 1.numeric value 2.backspace 3.single decimal Comments

No comments have been posted about TextBox that accepts only 1.numeric value 2.backspace 3.single decimal. Why not be the first to post a comment about TextBox that accepts only 1.numeric value 2.backspace 3.single decimal.

Post your comment

Subject:
Message:
0/1000 characters