The Simple Calculator, up to this point, crashes or comes up with confusing error messages, if a non-number is entered into the calculator.
We can make this situation more user friendly by using an error catching technique.
Using Try - Except can stabilize the program and tell the user what is happening if an error occurs.
Try Except Syntax
Try
Statement
Except
Statement
End;
Simple Calculator Tutorials
Tutorial 5 - Setting up the Form - Simple Calculator Part 1
Tutorial 6 - String Conversion - Simple Calculator Part 2
Tutorial 7 - RadioButtons - Simple Calculator Part 3
Tutorial 8 - Try Except Error Handling - Simple Calculator Part 4
Tutorial 9 - Tabs and Finished App - Simple Calculator Part 5
Code Download
SimpleCalculator.zip
Free Pascal
www.freepascal.org
Free Pascal Wiki
wiki.freepascal.org
Lazarus IDE
www.lazarus-ide.org
Lazarus Forum
forum.lazarus.freepascal.org/index.php?action=forum
Projects Using Lazarus
wiki.freepascal.org/Projects_using_Lazarus