This documentation is archived and is not being maintained.

ErrObject.HelpContext Property

Returns or sets an Integer containing the context ID for a topic in a Help file. Read/write.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public int HelpContext { get; set; }

Property Value

Type: System.Int32
Returns or sets an Integer containing the context ID for a topic in a Help file. Read/write.

The HelpContext property is used to display context-sensitive Help for an application. If a Help file is specified in HelpFile, the HelpContext property is used to automatically display the Help file identified. If both the HelpFile and HelpContext properties are empty, the value of the Number property is checked. If the value of the Number property corresponds to a Visual Basic run-time error value, then the Visual Basic Help context ID for the error is used. If the value of the Number property does not correspond to a Visual Basic error, the contents screen for the Visual Basic Help file is displayed.

NoteNote

You should write routines in your application to handle typical errors. When programming with an object, you can use the object's Help file to improve the quality of your error handling, or to display a meaningful message to your user if the error is not recoverable.

This example uses the HelpContext property of the Err object to show the Visual Basic Help topic for the Overflow error.


Dim Msg As String
Err.Clear()
On Error Resume Next   ' Suppress errors for demonstration purposes.
Err.Raise(6)   ' Generate "Overflow" error.
If Err.Number <> 0 Then
  Msg = "Press F1 or HELP to see " & Err.HelpFile & " topic for" & 
  " the following HelpContext: " & Err.HelpContext
  MsgBox(Msg, , "Error:")
End If


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: