On Error { GoTo line | Resume Next | GoTo 0 }
Sets BlueZone Basic’s error-handling method and if applicable specifies the line label of the error-handling routine.
The line parameter refers to a label. That label must be present in the code or an error is generated.
Review the use of the following properties in the examples below:
Example 1:
Sub Main On Error GoTo dude ' Turn on error checking Dim x as object x.draw ' Object not set jpe ' Undefined function call print 1/0 ' Division by zero Err.Raise 6 ' Generate an "Overflow" error MsgBox "Back" MsgBox "Jack" Exit Sub dude: On Error Resume Next ' turn off error checking MsgBox "HELLO" Print Err.Number, Err.Description Resume Next MsgBox "Should not get here!" MsgBox "What?" On Error Goto 0 ' turn on error checking End Sub
Example 2:
Sub mySub( myStr As String ) MsgBox myStr End Sub Sub Main Dim vbCrlf As String On Error Goto MyErr vbCrlf = Chr(13) & Chr(10) mySub myChk2Var mySub 1,2 Exit Sub MyErr: MsgBox "Error on line: " & err.LineNumber & vbCrlf & "Number: " & err.Number & vbCrlf & "Description: " & err.Description End Sub
The tables below show the corresponding descriptions for the defined values of x.
Value of x | Description |
---|---|
5 | “Invalid procedure call” |
6 | “Overflow” |
7 | “Out of memory” |
9 | “Subscript out of range” |
10 | “Array is fixed or temporarily locked” |
11 | “Division by zero” |
13 | “Type mismatch” |
14 | “Out of string space” |
16 | “Expression too complex” |
17 | “Can't perform requested operation” |
18 | “User interrupt occurred” |
20 | “Resume without error” |
28 | “Out of stack space” |
35 | “Sub, Function, or Property not defined” |
47 | “Too many DLL application clients” |
48 | “Error in loading DLL” |
49 | “Bad DLL calling convention” |
51 | “Internal error” |
52 | “Bad file name or number” |
53 | “File not found” |
54 | “Bad file mode” |
55 | “File already open” |
57 | “Device I/O error” |
58 | “File already exists” |
59 | “Bad record length” |
60 | “Disk full” |
62 | “Input past end of file” |
63 | “Bad record number” |
67 | “Too many files” |
68 | “Device unavailable” |
70 | “Permission denied” |
71 | “Disk not ready” |
74 | “Can't rename with different drive” |
75 | “Path/File access error” |
76 | “Path not found” |
91 | “Object variable or With block variable not set” |
92 | “For loop not initialized” |
93 | “Invalid pattern string” |
94 | “Invalid use of Null” |
Value of x | Description |
---|---|
429 | “OLE Automation server cannot create object” |
430 | “Class doesn't support OLE Automation” |
432 | “File name or class name not found during OLE Automation operation” |
438 | “Object doesn't support this property or method” |
440 | “OLE Automation error” |
443 | “OLE Automation object does not have a default value” |
445 | “Object doesn't support this action” |
446 | “Object doesn't support named arguments” |
447 | “Object doesn't support current local setting” |
448 | “Named argument not found” |
449 | “Argument not optional” |
450 | “Wrong number of arguments” |
451 | “Object not a collection” |
Value of x | Description |
---|---|
444 | “Method not applicable in this context” |
452 | “Invalid ordinal” |
453 | “Specified DLL function not found” |
457 | “Duplicate Key” |
460 | “Invalid Clipboard format” |
461 | “Specified format doesn't match format of data” |
480 | “Can't create AutoRedraw image” |
481 | “Invalid picture” |
482 | “Printer error” |
483 | “Printer driver does not supported specified property” |
484 | “Problem getting printer information from the system” |
Value of x | Description |
---|---|
485 | “Invalid picture type” |
520 | “Can't empty Clipboard” |
521 | “Can't open Clipboard” |