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.Source Property

Class

Microsoft.VisualBasic.ErrObject

Syntax

Err.Source

Description

A read/write string property containing the name of the application or the object that has generated the error.

Rules at a Glance

  • When a runtime error occurs in your code, the Source property is automatically assigned the project name (that is, the string that is assigned to the project’s Name property). Note that this is not necessarily the filename of the project file.

  • For clarity of your error messages, when you raise an error in a class module, the format of the source parameter should be project.class.

Programming Tips and Gotchas

Knowing what type of error has occurred within a program without knowing where the error was generated is often of little use to the programmer. However, if you enhance the standard Source by adding the name of the procedure, you can cut your debugging time dramatically.

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