Fixing a Run-Time Error

Some run-time errors result from simple oversights while you're writing the code; these errors are easily fixed. Suppose, for example, that you try to customize the title bar of the main application window by setting the Name property, as in the following code.


Application.Name = "My Custom Application"

When you run the code, a run-time error occurs. In this case, the solution is to fix the problem statement so that it uses the correct property, the Caption property, as in the following example.


Application.Caption = "My Custom Application"

You can use error handling to correct run-time errors that result from conditions other than simple coding errors. Error handling is discussed in the next chapter, "Handling Run-Time Errors."