1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Rep Power

    Pascal validation problem.

    Right, slight problem in Pascal that should be easy to sort but I cant see the solution. Im designing a payroll program for a college project and I have a space to enter wages. Now, I only want the user to be able to enter numbers, and all the letters entered to return a user message stating the letter has been entered and to re-enter the value. At the moment, it returns a runtime error.

    Has anyone got any ideas how to setup this validation? Thanks it advance.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    Read in a string instead of a numeric variable. Then iterate through the string and make sure that it only contains digit characters. If the string looks ok, then convert it to integer.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo