IsNumeric and IsAlpha

Y

yossimotro

Hi,

I'm using C# to write my ASP.NET code.
Is there anyway of using the above functions with C#?

Thanks,
Yossi.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Some litte hint of what those functions should do would be helpful...

This might be what you are looking for, or not at all...

You can add a reference to Microsoft.VisualBasic.dll to use the
Microsoft.VisualBasic.Information.IsNumeric method.

You can use Char.IsLetter(char) to check if a character is an alphabetic
letter.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

That's better. It so much easier to help someone who is telling the
purpose of the question instead of just asking for how to do it the way
he/she thinks that it is done. :)

The best validation for numeric values and dates is to actually try to
convert them. Use DateTime.TryParse and Int32.TryParse methods for
instance. If you use a parameterized query (which you really should),
you would want them converted anyway.

To validate string data you can use RegEx. To verify that a string only
contains alphabetic characters you use RegEx.IsMatch(theString,
"^[A-Za-z]$").
 
V

V

Hi,

Try using Regular Expression Validators. This will allow you to
validate any kind of data. Numeric and Alpha are simple regex
expressions which you will be able to find easily by searching on
google (that is if you cannot figue out how to write them on your own
from the MSDN documentation provided on them).

Regards,
Vaibhav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top