Error Checking

NI Vision for Visual Basic

Error Checking

NI Vision for Visual Basic controls can report error information to you and to the application in a number of different ways:

  • Return an error code from a function or method call
  • Generate an error or warning event
  • Throw an exception handled by the programming environment

The type of error reporting depends on the type of application and the preference of the programmer.

By default, all the NI Vision controls generate exceptions when errors occur, rather than returning error codes from the methods. However, the CWIMAQ, CWIMAQVision, and NIOCR controls have a property, ExceptionOnError, that you can set to False if you want methods to return error codes instead of generating exceptions. Error events are generated by the CWIMAQ control if an error occurs during specific contexts of an acquisition process. The contexts for which error events are generated are set in the ErrorEventMask property of the CWIMAQ control.

Related Topics

Exceptions

Return Codes

Error and Warning Events