ex.hlp (Topic list)
ERROR$ and INPUTBOX$ Functions Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' The example uses the ERROR$ function to display the error messages
' associated with user-input error numbers.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 DECLARE SUB ErrorDemo ()
 CALL ErrorDemo
 
 SUB ErrorDemo ()
     ON LOCAL ERROR GOTO Errorhandler          ' Set up error handler
     NL$ = CHR$(13) + CHR$(10)                 ' Define new line
     Msg$ = "Please enter an error number to see the associated error"
     Msg$ = Msg$ + " message."
     Usererror% = VAL(INPUTBOX$(Msg$))
     ERROR Usererror%                          ' Simulate error occurence
     EXIT SUB
 
Errorhandler:
     Msg$ = "The error message for error number "
     Msg$ = Msg$ + LTRIM$(STR$(ERR)) + " is:" + NL$ + NL$
     Msg$ = Msg$ + """" + ERROR$(ERR) + """"
     MSGBOX Msg$                               ' Display message
     RESUME NEXT
 
 END SUB