By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,610 Members | 1,307 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,610 IT Pros & Developers. It's quick & easy.

Input box Validation

P: 2
how can i validate a inputbox, i need it so that the user can only put numbers like, 10, 20 30 etc. the input box will input the data into a textbox. can some one help me pleasE?
Mar 21 '07 #1
Share this Question
Share on Google+
4 Replies


P: 62
You can do validation such

Expand|Select|Wrap|Line Numbers
  1.  
  2.           Dim sInput As Variant
  3.  
  4. Label_Check_Validation:
  5.  
  6.     sInput = InputBox("Enter Value", "Value")
  7.     If IsNumeric(sInput) = False Then
  8.         GoTo Label_Check_Validation
  9.     Else
  10.         'what u want to do next
  11.     End If 
  12.  
  13.  
Mar 21 '07 #2

P: 2
thanks ill try that out :)
Mar 21 '07 #3

P: 11
text1 is the textbox just put this code in the textbox key press event . u will get the result

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If Not ((KeyAscii >= 47 And KeyAscii <= 57) Or KeyAscii = 8) Then
Beep
KeyAscii = 0
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub
Mar 21 '07 #4

devonknows
100+
P: 137
how can i validate a inputbox, i need it so that the user can only put numbers like, 10, 20 30 etc. the input box will input the data into a textbox. can some one help me pleasE?
Just to point out that the same conversation was going on a few posts earlier, heres the link

http://www.thescripts.com/forum/thread620015.html

*Hint, when using the search function use specific words, like Numeric, Text box

If the above posts dont help, then maybe this other discussion will do

Kind Regards.
Devon.
Mar 21 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.