Link to home
Start Free TrialLog in
Avatar of sprawler
sprawler

asked on

Error handling in Delphi 1.0

Hi...

I am a student who is beginning to use Delphi 1.0 .
Would you pleez send me an explaination of how to and/or the specific code on :

1) While entering information into a database, if the wrong type of information is entered into a field of a specific type Delphi produces an error causing the program to stop.
An example would be, when alphanumeric data is entered into a numeric field and the record is posted, an error is produced and the program is terminated.

I need help on how to handle this error by giving the user an error message without terminating the program so that the user can go back and correct such a problem.

2) When one tries to post data into a table that is not in edit or insert mode, an error is produced and the program terminates. This is in the case where one uses a DBNAVIGATOR button.
 
How does one go about avoiding such termination by being able to provide the user with a suitable message to go back correct the situation.

If my questions are not sufficiently clear or ambigious, please provide any helpful information and coding on one goes about handling errors in Delphi 1.0.

Your attention will be highly appreciated.

Yours sincerely  
Sprawler.
ASKER CERTIFIED SOLUTION
Avatar of mirek071497
mirek071497

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sprawler
sprawler

ASKER

Hi.. Again mirek

I am uncertain what code would go into the areas you labelled :

{Place here instruction which could fail}
{This was called on error}

Please suggest code using an example, if possible.
Tanx for the speedy response to my question.

sprawler
Hi

if you get exception at any code then you could place this after the "try". When the "try" starting then all exceptions jump to the code after "except".

Sorry but my english is poor so i don't understand which example you need. Do you need example with TTable ?
Mayby you don't know wher to place the try..except ? If yes then I think so you have code which make the post and you must place the try..except there.
Hi again .....

An example of an error routine that you have used  or one that you could think up would be fine.  

Lets say that I am trying to enter data into a Table and the field requires an 8 digit number that is a primary key. Instead of typing in 8 digits,  I type in  7 digits. An error is displayed and the program terminates. how woul one program such an EXCEPTION.

Tanx
sprawler





Hi
sorry for the long time.

You must tell me more. Which database (DBF,Paradox ... ) and please submit your fields definition and simple code. I will try to help you.

BTW if you try use exceptions then please not in delphi because then you get always Exception from Delphi not from your proc. So compile program and run without delphi. I remember that you can set this in options, but now i don't know where.