- Home
·
- Miscellaneous
·
- How to enter numbers in a textbox, and some other characters, like a decimeal point
How to enter numbers in a textbox, and some other characters, like a decimeal point
How to enter numbers in a textbox, and some other characters, like a decimeal point
Rate How to enter numbers in a textbox, and some other characters, like a decimeal point
(1(1 Vote))
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
How to enter numbers in a textbox, and some other characters, like a decimeal point Comments
No comments yet — be the first to post one!
Post a Comment