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 - HelpContext Property

The HelpContext property of the Err object defines a help topic within the file identified by the HelpFile property. Together the two can be used to add additional help to a message box when an error is displayed to the user. An example of using a help file in conjunction with an error might look like this:

Dim Msg As String

Err.Number = 61 'Disk Full
Err.Description = "Your disk is full. Try another drive."
Err.HelpFile = "project1.hlp"
Err.HelpContext = 32 'context ID for a topic within the help file

Msg = Err.Number & "-" & Err.Description & vbCrLf & _
"To see more information, press F1."
MsgBox Msg, , "Error in Project1", Err.HelpFile, Err.HelpContext

This displays a message box containing the error number, description, and the option to get help from the help file identified by the HelpFile and HelpContext properties, as shown in Figure 11.2.

An error message with a Help option.
FIGURE 11.2 An error message with a Help option.


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved