473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IsNumeric and IsAlpha

Hi,

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

Thanks,
Yossi.

May 7 '06 #1
6 6089
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.
yo********@gmail.com wrote:
Hi,

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

Thanks,
Yossi.

May 7 '06 #2
Hi,

I need to validate data from textboxes before I add them to the sql
query.
I think adding a reference to VisualBasic is too comlicated, not that
it is hard but it just doesn't seem right.
Also is there a function to validate a date?

Thanks,
Yossi.

May 7 '06 #3
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]$").

yo********@gmail.com wrote:
Hi,

I need to validate data from textboxes before I add them to the sql
query.
I think adding a reference to VisualBasic is too comlicated, not that
it is hard but it just doesn't seem right.
Also is there a function to validate a date?

Thanks,
Yossi.

May 7 '06 #4
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

May 7 '06 #5
Try this
http://javascript.internet.com/forms...alidation.html

V wrote:
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


May 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: eje | last post by:
IsNumeric(value) should return false if value "can not be successfully converted to a Double." Instead I get the following error message: "Input string was not in a correct format." I use the...
4
by: Eugene Anthony | last post by:
I have received the following feedback for the two functions bellow: "The ISNUMERIC test is WORTHLESS for checking for an INT value, because ISNUMERIC will happily accept DOUBLE values, such as...
14
by: Kenny | last post by:
Hello, I would like to know if the function IsNumeric requires a header like #include <iostream> to be functionnal thanks ken
8
by: John Bowman | last post by:
Hello, Does anyone have a good/reliable approach to implementing an IsNumeric() method that accepts a string that may represent a numerical value (eg. such as some text retrieved from an XML...
7
by: Nathan Truhan | last post by:
All, I think I may have uncovered a bug in the IsNumeric function, or at least a misunderstanding on functionality. I am writing a Schedule Of Classes Application for our campus and have a...
8
by: dananrg | last post by:
Seems like most web hosting providers support MySQL, but not PostgreSQL. I need a web hosting account that supports PostgreSQL for a particular personal project I'm working on (as well as Python,...
8
by: moondaddy | last post by:
What's the .net framework equivalent of the vb function isnumeric? If there isn't one, how can I test a string variable to see if its a number or not? I don't want to use isnumeric if possible ...
12
by: sck10 | last post by:
Hello, I am trying to determine if a value is NOT numeric in C#. How do you test for "Not IsNumeric"? protected void fvFunding_ItemInserting_Validate(object sender, FormViewInsertEventArgs...
17
by: MLH | last post by:
I have tested the following in immed window: ?isnumeric(1) True ?isnumeric(1.) True ?isnumeric(1.2) True ?isnumeric(1.2.2)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.