VB6: HTML Help (CHM) from a button on your form

When you have created a help file and set the Help File and Help Context Id, you have the Help available via F1. If you want to promote the use of help, it is a good practice to also add a [Help] button. The approach described here allows you to implement a Help button with a minimum amount of effort (and code) on your forms.

Download
You can import the required module from the VB6 demo application which you can download from here: vb6_activating_help.zip
  1. Import the following modules and classes in your application: FormHtmlHelpHandler, CHTMLHelp and basHtmlHelp.
  2. Open the form you want to add the help button to in View Code
  3. In the left combo box select Form, in the left combo box select Load
  4. The VB editor opens with Private Sub Form_Open... End Sub inserted
    1. Insert code so that the result looks like this
      Private Sub Form_Load( )
          HTMLHelp.InitFormHelpHandler Me ,Me !cmdHelp
      End Sub

     5.    Add a [Help] button to a form 
     6.    Set the button property name to 'cmdHelp'

Now, assuming your form has valid properties set for Help File and Help Context Id and a matching help file, clicking the button, after switching to Form View, will open the corresponding page in the help file.

Tip
Your  Help File and Help Context Id - and Map and Alias files, topic files and the rest - are automatically set / created when you use the Help Generator add-in for VB6
VB6: starting help from code