HelpContext Property
Returns or sets an Integer containing the context ID for a topic in a Help file. Read/write.
Public Property HelpContext() As Integer
Remarks
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 doesn't correspond to a Visual Basic error, the contents screen for the Visual Basic Help file is displayed.
Note 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 isn't recoverable.
Example
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 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
Requirements
Namespace: Microsoft.VisualBasic
Class: ErrObject
Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)
See Also
Description Property | ErrorToString Function | HelpFile Property | LastDLLError Property | Number Property | Source Property