VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

IsNumber

Matthew Inman  (1 Submission)   String Manipulation   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

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




Rate IsNumber (6(6 Vote))
IsNumber.bas

IsNumber Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters