◄Summary► ◄Contents► ◄Index► ◄Back► ────────────────────────────────────────────────────────────────────────────── Error/Event Trapping Summary ■ Visual Basic provides several functions and statements that allow you to: • Trap errors or events while a program is running • Get error-status data • Define your own error codes ■ The following keywords are used in Visual Basic to perform error- and event-trapping tasks. With the exception of ON KEY and KEY ON, these event statements can also be used with object-specific events. See: ◄Object Events Summary► ◄COM Statement► Controls trapping of COM port events ◄ERDEV Function► Returns error code from device ◄ERDEV$ Function► Returns device name that generated error ◄ERL Function► Returns line number where error occurred ◄ERR Function► Returns the most recent run-time error code ◄ERR Statement► Assigns integer value to ERR ◄ERROR Statement► Simulates occurrence of an error ◄ERROR$ Function► Returns error message for specified error code ◄EVENT Statement► Enables/disables event trapping ◄GOSUB...RETURN Statement► Branches to and returns from a subroutine ◄KEY Statement► Controls trapping of defined KEY events ◄LOCAL Keyword► Indicates local error-handling routine ◄OFF Keyword► Disables event trapping with event statements ◄ON Keyword► Enables event trapping/specifies events to trap ◄ON COM Statement► Branches to routine on defined COM event ◄ON ERROR Statement► Enables error handling during program execution ◄ON KEY Statement► Branches to routine on defined KEY event ◄ON PEN Statement► Branches to routine on defined PEN event ◄ON PLAY Statement► Branches to routine when less than queuemin% ◄ON STRIG Statement► Branches to routine on defined STRIG event ◄ON TIMER Statement► Branches to routine on defined TIMER event ◄ON UEVENT Statement► Defines event handler for user-defined event ◄PEN Statement► Controls trapping of defined PEN events ◄PLAY Statement► Controls trapping of defined PLAY events ◄RESUME Statement► Resumes program execution after error handling ◄SetUEvent Routine► Sets entry point for user-defined event ◄STRIG Statement► Controls trapping of defined STRIG events ◄TIMER Statement► Controls trapping of defined TIMER events ◄UEVENT Statement► Controls trapping of user-defined events See: ◄Keywords by Task► ◄Run-Time Error Codes►