TextBox that only accepts integers?

  • Thread starter Thread starter Claud Balls
  • Start date Start date
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.
 
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
 
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

Back
Top