Error Event

Occurs when there is a run-time error in a method.

PROCEDURE Object.Error
LPARAMETERS [nIndex,] nError, cMethod, nLine

Parameters

Visual FoxPro passes the Error event three or four parameters in the following order:

  • nIndex
    Uniquely identifies a control if it is in a control array.
  • nError
    Contains the Visual FoxPro error number.
  • cMethod
    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.
  • nLine
    Contains the line number within the method or user-defined function that caused the error.

Remarks

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.

See Also

ON ERROR

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