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.
|You can import the required module from the VB6 demo application which you
can download from here: vb6_activating_help.zip
- Import the following modules and classes in your application:
FormHtmlHelpHandler, CHTMLHelp and basHtmlHelp.
- Open the form you want to add the help button to in View Code
- In the left combo box select Form, in the left combo box select Load
- The VB editor opens with Private Sub Form_Open... End Sub inserted
- Insert code so that the result looks like this
5. Add a [Help] button to a
6. Set the button property name to
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.
|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