O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Err.Raise Method

Class

Microsoft.VisualBasic.ErrObject

Syntax

Err.Raise(number, source, description, _
             helpfile, helpcontext)
number (required; Long integer)

A numeric identifier of the particular error

source (optional; String)

The name of the object or application responsible for generating the error

description (optional; String)

A useful description of the error

helpfile (optional; String)

The fully qualified path of a Microsoft Windows Help file containing help or reference material about the error

helpcontext (optional; Long)

The context ID within helpfile

Description

Generates a runtime error

Rules at a Glance

  • To use the Err.Raise method, you must specify an error number.

  • If you supply any of the number, source, description, helpfile, and helpcontext arguments when you call the Err.Raise method, they are supplied as values to the Number, Source, Description, HelpFile, and HelpContext properties, respectively. Refer to the entries for the individual properties for full descriptions of and rules for each property.

  • The number argument is a Long integer that identifies the nature of the error. Visual Basic errors (both Visual Basic-defined and user-defined errors) are in the range 0-65535. The range 0-512 is reserved for system errors; the range 513-65535 is available for user-defined errors. When setting the Number property to your own error code in a class module, you add your error-code number to the vbObjectError constant.

Programming Tips and Gotchas

  • The Err.Raise method replaces ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required