Hi all

I am working on a bank reconciliation program and have a problem with data entry.
For a readln (real) statement, if a character is entered, it crashes the program. Is there a way to test the input data to keep it from crashing the program?

Also is there a way to run a control loop in the background so that I don’t have to enter a character to continue the loop with each entry. Initially I have I t set up so that I enter “c” from a menu to enter checks, and then for each additional entry I have to say “c” to repeat the loop for another entry. (In other words I would like to just be able to enter a loop and stay there until I am done entering the checks, and then just hit “x” or whatever to exit the loop, without having to restart the loop with each entry.)

11 Years
Discussion Span
Last Post by frogeye


To prevent it from crashing put the conversion code in a try except block, if there will be a problem Delphi will throw an exception and you can handle it on the except part. To prevent typing c for new entries just let the user enter values one each other till he hits Enter alone (readln will return an empty string) or it writes "exit" then check entered string for exit or empty string.

Loren Soth

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.