Run-time Errors

Every run-time error number that has a message of its own, with that message, and the reference pages that list each number among the errors their procedure raises.

A run-time error can be trapped: On Error sends it to a handler, which reads its number from Err.Number and its message from Err.Description. A reference page that documents a procedure, a statement or an operator has a Common Errors section when it raises errors of its own: a table of each number it raises, and when. Each number there links to its row below.

What the Common Errors sections list

A section lists the errors that a procedure raises from its own arguments and its own state, as twinBASIC raises them. Where VB6 raises another error, or none, a note under the table says so. Every row is measured in twinBASIC and in VB6, and not copied from another reference.

A section does not list:

  • errors that any code can raise: 7, Out of memory, and 28, Out of stack space;
  • errors in converting an argument to the type its page gives for the parameter: 13, Type mismatch, for an argument of the wrong kind, such as Mid("abc", "x"), and 6, Overflow, for a number outside the range of that type, such as a start of 2147483648 for Mid, whose start is a Long. A Null argument is listed, whether the procedure raises the error itself or in converting the argument: Mid("abc", Null) raises 94, Invalid use of Null;
  • compile-time errors: the twinBASIC compiler reports these with diagnostic codes such as TB5001, before the program runs, and On Error cannot trap them.

A procedure that raises no error of its own has no Common Errors section.

How a number is written

Each number is given in decimal and in hexadecimal, as a 32-bit Long: 5 (&H5), -2147467259 (&H80004005). Numbers from 1 to 65535 are VB’s own. A negative number is an HRESULT, a COM error code. Errors that a program raises for itself with Err.Raise usually add their own code to vbObjectError, -2147221504 (&H80040000).

The message is the one that Err.Description gives for the error once it is raised. For the numbers from 1 to 65535, Error(number) gives the same text. For an HRESULT, Error gives Application-defined or object-defined error, as it does for any number without a message of its own, and the table shows both.

Note BETA 1010

For a number from 1 to 65535 that has no message of its own, Error gives Application-defined or object-defined error in twinBASIC and VB6. After Err.Raise of such a number, Err.Description in VB6 is that same text; in twinBASIC it is empty for a number below 747, and for 747 and above it is the Windows system message of that number, such as Page fault was a transition fault. for 747.

Error numbers

The messages are those of twinBASIC 32-bit and VB6, which agree for every number from 1 to 65535. Listed by links to the number’s line under Pages that list each error, which names the pages whose Common Errors section lists it, in alphabetical order.

Error Message Listed by
3 (&H3) Return without GoSub —
5 (&H5) Invalid procedure call or argument 22 pages
6 (&H6) Overflow 1 page
7 (&H7) Out of memory —
9 (&H9) Subscript out of range 1 page
10 (&HA) This array is fixed or temporarily locked —
11 (&HB) Division by zero —
13 (&HD) Type mismatch 3 pages
14 (&HE) Out of string space —
16 (&H10) Expression too complex —
17 (&H11) Can’t perform requested operation —
18 (&H12) User interrupt occurred —
20 (&H14) Resume without error —
28 (&H1C) Out of stack space —
35 (&H23) Sub or Function not defined —
47 (&H2F) Too many DLL application clients —
48 (&H30) Error in loading DLL —
49 (&H31) Bad DLL calling convention —
51 (&H33) Internal error —
52 (&H34) Bad file name or number —
53 (&H35) File not found —
54 (&H36) Bad file mode —
55 (&H37) File already open —
57 (&H39) Device I/O error —
58 (&H3A) File already exists —
59 (&H3B) Bad record length —
61 (&H3D) Disk full —
62 (&H3E) Input past end of file —
63 (&H3F) Bad record number —
67 (&H43) Too many files —
68 (&H44) Device unavailable —
70 (&H46) Permission denied —
71 (&H47) Disk not ready —
74 (&H4A) Can’t rename with different drive —
75 (&H4B) Path/File access error —
76 (&H4C) Path not found —
91 (&H5B) Object variable or With block variable not set —
92 (&H5C) For loop not initialized —
93 (&H5D) Invalid pattern string —
94 (&H5E) Invalid use of Null 28 pages
96 (&H60) Unable to sink events of object because the object is already firing events to the maximum number of event receivers that it supports —
97 (&H61) Can not call friend function on object which is not an instance of defining class —
98 (&H62) A property or method call cannot include a reference to a private object, either as an argument or as a return value —
321 (&H141) Invalid file format —
322 (&H142) Can’t create necessary temporary file —
325 (&H145) Invalid format in resource file —
380 (&H17C) Invalid property value —
381 (&H17D) Invalid property array index —
382 (&H17E) Set not supported at runtime —
383 (&H17F) Set not supported (read-only property) —
385 (&H181) Need property array index —
387 (&H183) Set not permitted —
393 (&H189) Get not supported at runtime —
394 (&H18A) Get not supported (write-only property) —
422 (&H1A6) Property not found —
423 (&H1A7) Property or method not found —
424 (&H1A8) Object required —
429 (&H1AD) ActiveX component can’t create object —
430 (&H1AE) Class does not support Automation or does not support expected interface —
432 (&H1B0) File name or class name not found during Automation operation —
438 (&H1B6) Object doesn’t support this property or method —
440 (&H1B8) Automation error —
442 (&H1BA) Connection to type library or object library for remote process has been lost. Press OK for dialog to remove reference. —
443 (&H1BB) Automation object does not have a default value —
445 (&H1BD) Object doesn’t support this action —
446 (&H1BE) Object doesn’t support named arguments —
447 (&H1BF) Object doesn’t support current locale setting —
448 (&H1C0) Named argument not found —
449 (&H1C1) Argument not optional —
450 (&H1C2) Wrong number of arguments or invalid property assignment —
451 (&H1C3) Property let procedure not defined and property get procedure did not return an object —
452 (&H1C4) Invalid ordinal —
453 (&H1C5) Specified DLL function not found —
454 (&H1C6) Code resource not found —
455 (&H1C7) Code resource lock error —
457 (&H1C9) This key is already associated with an element of this collection —
458 (&H1CA) Variable uses an Automation type not supported in Visual Basic —
459 (&H1CB) Object or class does not support the set of events —
460 (&H1CC) Invalid clipboard format —
461 (&H1CD) Method or data member not found —
462 (&H1CE) The remote server machine does not exist or is unavailable —
463 (&H1CF) Class not registered on local machine —
481 (&H1E1) Invalid picture —
482 (&H1E2) Printer error —
735 (&H2DF) Can’t save file to TEMP —
744 (&H2E8) Search text not found —
746 (&H2EA) Replacements too long —
-2147467259 (&H80004005) Unspecified error; Error gives Application-defined or object-defined error 1 page

Pages that list each error

5 (&H5): Asc, Chr, Filter, Format, FormatCurrency, FormatDateTime, FormatNumber, FormatPercent, InStr, InStrRev, Join, Left, Mid, MonthName, Replace, Right, Space, Split, StrComp, StrConv, String, WeekdayName

6 (&H6): Chr

9 (&H9): ReDim

13 (&HD): Filter, Join, ReDim

94 (&H5E): Asc, Chr, Filter, Format, FormatCurrency, FormatDateTime, FormatNumber, FormatPercent, InStr, InStrRev, Join, LCase, Left, LTrim, Mid, MonthName, Replace, Right, RTrim, Space, Split, StrComp, StrConv, String, StrReverse, Trim, UCase, WeekdayName

-2147467259 (&H80004005): ReDim

See Also