Click here to Skip to main content
11,630,646 members (77,805 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
How to know user entered numeric or character in text box
Posted 21-Feb-13 17:50pm
Comments
Sergey Alexandrovich Kryukov at 21-Feb-13 23:53pm
   
First of all, you need to tag your UI library or application type. In other words, what is TextBox? Exact full type name, please.
And ask the question properly. What is "to know"?
—SA
C M Senergy at 21-Feb-13 23:55pm
   
Normal Textbox
C M Senergy at 21-Feb-13 23:55pm
   
SearchingText Box for searching perpose
C M Senergy at 21-Feb-13 23:56pm
   
Actually i am using text box for searching EmpCode as well as Emp Name
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

See this

<script>
 
document.write(isNaN(123)+ "<br>");
document.write(isNaN(-1.23)+ "<br>");
document.write(isNaN(5-2)+ "<br>");
document.write(isNaN(0)+ "<br>");
document.write(isNaN("Hello")+ "<br>");
document.write(isNaN("2005/12/12")+ "<br>");
 
</script>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Use IsNumeric function for eg:-

If IsNumeric(txtNAme.Text)=True then
Statement 1
Else
Statement 2
End If
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Check the Length of the Text; if greater than zero, then the user entered something and what else could it be?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


Advertise | Privacy | Mobile
Web04 | 2.8.150723.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100