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

Using the Error Function

A function related to errors and error processing is the Error function. The Error function has one argument—an error number. It returns a string description of the error corresponding to that number. For example, if you coded the following:

Msgbox Error(61)

the user would see a message box with the error description Disk full, as shown in Figure 11.5.

An error message from the Error function.
FIGURE 11.5 An error message from the Error function.

If the error number is not specified, the description of the most recent runtime error is displayed (the same value as Err.Description). If there have been no runtime errors, the result is a 0 length string.

If the error number is valid but has no Visual Basic definition, the return value will be Application-Defined or Object-Defined Error. An error will occur if the error number is not valid.


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved