|
-
May 29th, 2006, 02:32 PM
#1
Thread Starter
New Member
I need textbox help
Is it possible to get a texbox on a web form to accept only numbers? I have a form that has a dollar amount that people have to add in. Because of the way it is handled in the database, the amount must be numbers (40) instead of text (forty). I've found a few people typing the amount in text and it reeks havoc in the database. Any help would be great.
Thanks
Brian
-
May 29th, 2006, 02:56 PM
#2
Junior Member
Re: I need textbox help
I'm not sure if this function still exists but you could use val(yourtextbox.text), check if it returns 0 or not, if it does, just display a message box stating that they have to enter a number.
VB Code:
if val(yourtextbox.text) = 0 then
msgbox("Must enter numbers only, no text and no zeros)
else
other code here
end if
of course, to use this you have to make sure that you don't need people to enter in just a zero in the textbox.
-
May 29th, 2006, 09:03 PM
#3
Hyperactive Member
Re: I need textbox help
You can also use the Validation controls. Specifically use the compare control and set the type to integer. Or you can use a RegEx in a function, but that might be overkill [\d]
-
May 30th, 2006, 05:12 AM
#4
Re: I need textbox help
The validator would be the best option, IMEO.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|