This routine was designed to act as a numbers-only mask for any TextBox Keypress event. Simply call it from any KeyPress event and feed it the KeyAscii return value.
Inputs
AsciiCode - This is the ascii code of the character to be tested.
Assumes
HOW TO CALL:
In the KeyPress event of Text1 (just an example), all you need is
If Not IsNumber(KeyAscii) then KeyAscii=0
and the text box will accept only numbers from the user while allowing them to use BACKSPACE.
Returns
Returns TRUE if the ascii code was of a numeric character OR backspace (saves time...you'll see), FALSE if not.
API Declarations