Handle Errors During a Method Call

If your application generates an error while creating a class instance or during a class method call, the current procedure creates an exception.

Microsoft® Visual Basic® provides an exception handling capability through the On Error Goto <label> statement, in which the program execution jumps to <label> when an error occurs. (<label> must be located in the same procedure as the On Error Goto statement.) All errors in Visual Basic are handled this way, including errors within the MATLAB® code that you have encapsulated into a COM object. An exception creates a Visual Basic ErrObject object in the current context in a variable called Err.

See the Microsoft Visual Basic documentation for a detailed discussion on Visual Basic error handling.

Was this topic helpful?