Err.Raise Method


Err.Raise Method

Class

Microsoft.VisualBasic.ErrObject

Syntax

     Err.Raise(number[, source[, description[, helpFile, helpContext]]]) 


number (required; Integer)

A numeric code for a particular error


source (optional; String)

The name of the project, application, or class responsible for generating the error


description (optional; String)

A useful description of the error


helpFile (optional; String)

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


helpContext (optional; Integer)

The context ID within helpFile

Description

The Raise method generates a runtime error, specifying the details of the error, including optional online help file information.

Usage at a Glance

  • If you supply any of the number, source, description, helpFile, or helpContext arguments when you call the Err.Raise method, they are supplied as values to the Number, Source, Description, HelpFile, and HelpContext properties of the Err object, respectively. Refer to the entries of the individual properties in this chapter for additional information.

  • Visual Basic errors are in the range 0 to 65535. The range 0 to 512 is reserved for system errors; the range 513 to 65535 is available for user-defined errors. When setting the Number property to your own error code, add the vbObjectError constant to your error code.

  • The Raise method does not reinitialize the Err object prior to assigning the values you pass in as arguments. Any Err object property values not explicitly assigned through the Raise method are retained.

Version Differences

Although the Error statement is still included in the .NET version of Visual Basic, it should not be used. Use the Err.Raise method instead.

See Also

Err Object, Err.Clear Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net