Show Sitemap ..Help2HTMLHelpWinHelp
Home ..

Calling Help

There is a System.Windows.Forms.Help object that is working together with the HelpProvider component to show CHM or HTML help files. You can use it in the forms "Help" menu. To provide Help to your application, call the ShowHelp und ShowHelpIndex methods.
The Help object is a static class that encapsulates the HTMLHelp 1.x engine, it cannot be instantiated and its methods must be called directly.

To display the CHM file with opened Contents tab

Add the following code to the handle of the menu item:

  Private Sub mnuHelpContents_Click(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles mnuHelpContents.Click
    ' Show the contents of the help file.
    Help.ShowHelp(Me, hlpProvider1.HelpNamespace)
  End Sub

 

Calling by ContextID (Workaround)

Add the following code to the handle:

  Private Sub mnuHelpShowHelp_Click(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles mnuHelpShowHelp.Click
    '--- This works very slow and had never worked before
    '--- workaround through Ken COX [MVP] &HF = 15 = HH_HELP_CONTEXT
    '--- fix will come in .NET 2.0 BETA through new value HelpNavigator.TopicId
    '--- This works only with Option Strict OFF !!
    '--- updated 2004-12-08 -----------------------------------
    Dim iContextID As Integer
    iContextID = 10010
    Help.ShowHelp(Me, Me.hlpProvider1.HelpNamespace, &HF, iContextID)
  End Sub

see also:

To display the CHM file with opened Index tab

Add the following code to the handle of the menu item:

  Private Sub mnuHelpIndex_Click(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles mnuHelpIndex.Click
    ' Show index of the help file.
    Help.ShowHelpIndex(Me, hlpProvider1.HelpNamespace)
  End Sub

 

To display the CHM file with opened Search tab

Add the following code to the handle of the menu item:

  Private Sub mnuHelpSearch_Click(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles mnuHelpSearch.Click
    ' Show the search tab of the help file.
    Help.ShowHelp(Me, hlpProvider1.HelpNamespace, HelpNavigator.Find, "Basic")
  End Sub

 

Download Example

Unfortunately, you don't have Visual Studio .NET but you have installed the Microsoft .NET Framework 1.0 (e.g. from your CD-Version of Windows XP SP1) unzip the example for Visual Basic 2002 and double-click the file VBnetCHM.exe.

 

Top ...