Occurs when there is a run-time error in a method.
PROCEDURE Object.Error LPARAMETERS [nIndex,] nError, cMethod, nLine
Visual FoxPro passes the Error event three or four parameters in the following order:
- Uniquely identifies a control if it is in a control array.
- Contains the Visual FoxPro error number.
- Contains the name of the method that caused the error. However, if a method calls a user-defined function, and an error occurs within that function, cMethod contains the name of the user-defined function, rather than the name of the method that called the function.
- Contains the line number within the method or user-defined function that caused the error.
The Error event allows an object to handle errors. This event overrides the current ON ERROR routine and allows each object to trap and handle errors internally.
Note The Error event is called only when the error occurs in code.
Applies To: ActiveDoc Object | CheckBox | ComboBox | CommandButton | CommandGroup | Container Object | Control Object | Cursor | Custom | DataEnvironment | EditBox | Form | FormSet | Grid | Image | Label | Line | ListBox | OLE Bound Control | OLE Container Control | OptionButton | OptionGroup | Page | PageFrame | ProjectHook Object | Relation | Session Object | Shape | Spinner | TextBox | Timer | ToolBar