Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder Rappa's Avatar
    Join Date
    Nov 2005
    Location
    LI
    Posts
    356
    Thanks
    21
    Thanked 9 Times in 9 Posts

    Only allowing certain types of input?

    I totally dont remember how to do this:

    I have some text boxes, which should only accept integers, but i cant remember how to give an error if the user enters a letter instead of a number.

    and ideas?

    its in C#

    -rappa

  • #2
    Regular Coder
    Join Date
    May 2004
    Location
    New Hampshire, America
    Posts
    246
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Not sure about C#, but in C++ I would compare the hex value of each inputted character to make sure it fell inside the alphabets acceptable range. I could give you some pseudo code but I'm not that familiar with C#.

  • #3
    Regular Coder
    Join Date
    Dec 2002
    Location
    Minneapolis, MN
    Posts
    208
    Thanks
    0
    Thanked 1 Time in 1 Post
    I don't even code in C#, and I found the answer. So many languages are the same, you just have to know what to look for.

    http://msdn2.microsoft.com/en-us/lib...fs(VS.71).aspx
    OR
    http://www.thescarms.com/dotnet/IsNumeric.aspx

    Some languages actually have methods like isString and isInteger
    anthony


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •