Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Visual Basic only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
Visual Basic
validating Text box input
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
ruvini218
New Member
Join Date:
Feb 2008
Posts:
1
#1
validating Text box input
Feb 22 '08, 11:00 AM
How can i make a text box to accept only numeric values?
jamesd0142
Contributor
Join Date:
Sep 2007
Posts:
471
#2
Feb 22 '08, 11:17 AM
Use code such as:
[codetext]
if integer.parse(t extbox1.text) = true then
'do what you want
end if
[/code]
Comment
Post
Cancel
debasisdas
Recognized Expert
Expert
Join Date:
Dec 2006
Posts:
8119
#3
Feb 22 '08, 11:29 AM
try handle the keyascii in the keypress event of the textbox.
accept the required values and discard the rest.
Comment
Post
Cancel
werks
New Member
Join Date:
Dec 2007
Posts:
218
#4
Feb 22 '08, 03:02 PM
try this
[CODE=vb 6]
Public Function OnlyNum(KeyAsci i As Integer)
Select Case KeyAscii
Case 48 To 57 '0-9
Case 13 'carriage return
Case 8 'backspace
Case Else
KeyAscii = 0 'null
End Select
End Function
[/CODE]
--
Kenneth
"Better Than Yesterday"
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment