Occurs when you try to assign a value to an object that is an incorrect data type.
ErrorNumber As Integer
Used to contain an error number that describes the runtime error.
Message As String
Used to contain descriptive text to display when the runtime exception is encountered.
Constructor(message As String = "", errorCode As Integer = 0)
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Used to raise your own RuntimeException with a message and optional error code.
Stack As String()
Returns a String array that contains a list of all of the methods in the stack from the main entrypoint to the point at which the exception was invoked.
The stack contains all the method names up and including the current method name.
This feature only works if the IncludeFunctionNames property on the App object is selected in the Shared Build Settings.
In addition to your own method calls, you will also see framework method calls, but these may not always be completely accurate due to insufficient symbols for the OS to resolve.
StackFrames As StackFrame()
Returns an array containing the stack when the exception was first raised.
A TypeMismatchException error occurs when you try to assign a value of an incorrect data type to an object. This error can occur only if the compiler cannot determine the type of the value at compile time - for example, when using variants. Ordinarily, the compiler catches incorrect typing when you try to compile the application.
The following code assigns a picture that has been added to the Project Editor to the variant, v, and then tries to assign v to an Integer. The Exception statement displays a message box, allowing the developer to track down the problem. Exception handling prevents the built application from quitting when the error occurs.
Var v As Variant Var i As Integer v = ProductLogo // a picture i = v Exception err If err IsA TypeMismatchException Then MessageBox("The variable i must be assigned a number!") End If
All project types on all supported operating systems.
RuntimeException parent class; RuntimeException class; Function, Raise, Sub statements; Nil datatype; Exception, Try statements.