by Arongard (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 30th November 2003
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
How to enter numbers in a textbox, and some other characters, like a decimeal point
Dim C ' declaration of a variable (can be anything you want)
C = Chr(KeyAscii) 'tells C (the variable) to recognize which key was pressed
If (C < "0" Or C > "9") And C <> vbBack Then 'the <> part tells what other key
'should be accepted, in this case
' you can erase the last number.
' if you put <> "." you can also
' enter a decimal point
KeyAscii = 0 'if the key pressed is none of the above (number or backspace) it
' erases such character
End If
No comments have been posted about How to enter numbers in a textbox, and some other characters, like a decimeal point. Why not be the first to post a comment about How to enter numbers in a textbox, and some other characters, like a decimeal point.