TextBox that only accepts integers?

C

Claud Balls

What would be the best way to check that text is a positive whole
number? I'm thinking about putting it in the textbox_exit event.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
H

Harald Staff

Hi

Exit is too late. Use the Keypress event. Set keyascii to 0 if its < 48 or

Except (tricky part coming up): Keydown event to trap and validate Ctrl V.

HTH. Best wishes Harald
 
J

Jim Thomlinson

You can validate the contents of the textbox using the isnumeric function.
You will also have to look for "-" and "." using the instr function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top