Visual Basic Reference

HelpContextID Property

See Also    Example    Applies To

Returns or sets an associated context number for an object. Used to provide context-sensitive Help for your application.

Syntax

object.HelpContextID [= number]

The HelpContextID property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list. If object is omitted, the form associated with the active form module is assumed to be object.
number A numeric expression that specifies the context number of the Help topic associated with object.

Settings

The settings for number are:

Setting Description
0 (Default) No context number specified.
> 0 An integer specifying a valid context number.

Remarks

For context-sensitive Help on an object in your application, you must assign the same context number to both object and to the associated Help topic when you compile your Help file.

If you've created a Microsoft Windows operating environment Help file for your application and set the application's HelpFile property, when a user presses the F1 key, Visual Basic automatically calls Help and searches for the topic identified by the current context number.

The current context number is the value of HelpContextID for the object that has the focus. If HelpContextID is set to 0, then Visual Basic looks in the HelpContextID of the object's container, and then that object's container, and so on. If a nonzero current context number can't be found, the F1 key is ignored.

For a Menu control, HelpContextID is normally read/write at run time.  But HelpContextID is read-only for menu items that are exposed or supplied by Visual Basic to add-ins, such as the Add-In Manager command on the Add-Ins menu.