11.4. Error ConstantsThe sample code in the previous section demonstrated the Err.Raise method being used for custom error reporting. Since .NET already uses this same method to indicate predefined system errors, there needs to be some way to confirm that your code's custom error numbers do not conflict with system-defined error numbers. Visual Basic defines a constant, vbObjectError, that assists in the selection of custom error-code values. This constant represents the minimum error code you should use for your own custom error messages. The recommended range is from vbObjectError to vbObjectError + 65535. If your application interacts with COM components, you should start your error codes with vbObjectError + 512, since COM components often use the first 512 values in this range for their own error codes. |