Visual Basic Concepts

Using the ShowHelp Method to Display a Help File

See Also

The ShowHelp method of the common dialog control allows you to display a Help file.

To display a Help file using the ShowHelp method

  1. Set the HelpCommand and HelpFile properties.

  2. Use the ShowHelp method to display the specified Help file.

The following code displays the specified Help file when the user clicks the Command1 command button:

Private Sub Command1_Click()
   ' Set Cancel to True.
   CommonDialog1.CancelError = True
   On Error GoTo ErrHandler
   ' Set the HelpCommand Property
   CommonDialog1.HelpCommand = cdlHelpForceFile
   ' Specify the Help file.
   CommonDialog1.HelpFile = "c:\Windows\Cardfile.hlp"
   ' Display the Windows Help engine.
   CommonDialog1.ShowHelp
   Exit Sub

ErrHandler:
   ' User pressed Cancel button.
   Exit Sub
End Sub

For More Information   See "HelpCommand Property," "HelpFile Property," and "ShowHelp Method" for more information on displaying Help files with the common dialog control.