IsNumeric and IsAlpha

Discussion in 'ASP .Net' started by yossimotro@gmail.com, May 7, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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.


    wrote:
    > 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?=, May 7, 2006
    #2
    1. Advertising

  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]$").

    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.
    >
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, May 7, 2006
    #3
  4. V Guest

    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
     
    V, May 7, 2006
    #4
  5. Guest

    Try this
    http://javascript.internet.com/forms/regexp-validation.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, 2006
    #5
  6. Guest

    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex

    isalpha(0), etc

    Alex, May 17, 2004, in forum: C Programming
    Replies:
    3
    Views:
    390
    RĂ©gis Troadec
    May 17, 2004
  2. Marcelo Urbano Lima

    object instance after if isalpha()

    Marcelo Urbano Lima, Apr 13, 2006, in forum: Python
    Replies:
    1
    Views:
    384
    Ben Cartwright
    Apr 13, 2006
  3. Marcelo Urbano Lima

    RE: object instance after if isalpha()

    Marcelo Urbano Lima, Apr 13, 2006, in forum: Python
    Replies:
    0
    Views:
    412
    Marcelo Urbano Lima
    Apr 13, 2006
  4. Replies:
    3
    Views:
    344
  5. rep_movsd
    Replies:
    15
    Views:
    990
    Francesco
    Aug 17, 2009
Loading...

Share This Page