VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 11

Properties of the Err Object - Source Property

The Source property of the Err object is a string expression of the location at which the error occurred in your application. If an unexpected runtime error occurs, Visual Basic sets the Err.Source for you. If the error occurred in a standard module, the source will be set to the project name. If the error occurred in a class module, Visual Basic uses the project name and the class module name for the source. For errors in class modules, the source will have the form project.class.

Like the Number and Description properties, the Source property can be set in code. Even if Visual Basic generates the error and populates the properties of the Err object, you might want to overlay the source with a more descriptive text. Because Visual Basic uses only the project, class, and form names to create the source description, you may want to add to the source to specify a more exact location for the error. You could add the name of the procedure in which the error occurred, for example.

The Err.Source property is typically used in an error-handling routine within a procedure or a common error-handling procedure for the application (see the section "Handling Errors in Code").


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved