I am using Text Boxes to make changes to a variable set as a Currency type. How do I ensure that a non numeric string cannot be entered into the Text Box?
Denk,<br><br>In the keypress event you can accept or reject any keystroke. It gets passed a variable called KeyAscii - you test that by saying something like<br><br>if asc(KeyAscii) = '1' etc<br><br>if you don't like the character the user types you can set the value of KeyAscii to zero to reject it.<br><br>Oh - and don't forget to allow the user to type a backspace, character number 8, I always forget this and have to go back and modify the event afterwards.<br><br><br> <p>Mike<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href=
Cargill's Corporate Web Site</a><br>Please don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?" My home email is michael.j.lacey@ntlworld.com<
You could use <b>isnumeric</b><br><br>if isnumeric(text1.txt) = false then<br> msgbox "Please enter a number"<br>end if<br><br>
There's a FAQ entry on this now<br><br>Category "<b>Processing User Input=</b>"<br>Question "<b>How do I make sure that only numbers are entered into a text box?</b>" <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
Cargill's Corporate Web Site</a><br>Please -- Don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.