how to check character in between 0 to 9 in asp

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P>&nbsp;</P>
<%
dim i , j,chStr
chstr="12G43"

For i= 0 to (len(chstr)-1)

	if (Asc(mid(chStr,i+1,1)) > 64 and Asc(mid(chStr,i+1,1)) < 90)  then

		RESPONSE.WRITE mid(chStr,i+1,1) & "CHARACTER ENTRY" &  "<br />"
		Exit For
	else

		response.write mid(chStr,i+1,1) & "NUMBER ENTRY" &  "<br />"
	end if 

Next
response.write "Done"
%>
</BODY>
</HTML>
If IsNumeric(TheForm.Text1.Value) Then
    If TheForm.Text1.Value < 1 Or TheForm.Text1.Value > 10 Then
      MsgBox "Please enter a number between 1 and 10."
    Else
      MsgBox "Thank you."
    End If
  Else
    MsgBox "Please enter a numeric value."
  End If

Hi this code is working well and good.........

If u have doubts here regarding this code u can remind me...

Thank U

In many way you can check it..

Also you can check by

If chstr > 0 Then
' Your Code Heree...
End IF

If there is any one alpha character then the condition will be false if not then 100% all the numbers will be in between 0-9...

But Using RegExp is the better choice.

Okay Good.......
Thank U...

It is better to use here RegExp as U said like this .........

If ?U want to check Alphabetics also , U can use this code


regExp.Pattern = "[A-Z]|[a-z]|[0-9]"


set match = regExp.Execute(spec)


Thank U
Urs Venu.K

In many way you can check it..

Also you can check by

If chstr > 0 Then
' Your Code Heree...
End IF

If there is any one alpha character then the condition will be false if not then 100% all the numbers will be in between 0-9...

But Using RegExp is the better choice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.