Home > OS >  CHM File in .Net project: can't reach the topic Id correctly
CHM File in .Net project: can't reach the topic Id correctly

Time:01-17

Context:

I made a chm file with the free version of Help'n'Doc to use it in a .Net Application. This help has to be call by clicking on a button and open on the proper help page.

Problem:

Instead of having this (the correct page in the Contents tab): enter image description here

I got this: enter image description here

Details:

Here's the code to call the help: Help.ShowHelp(Me.btnHashtagHelp, pathHelpFile, HelpNavigator.TopicId, "6")

Here's the page in Help'N'Doc: help'n'doc

What did i do wrong?

CodePudding user response:

I assume it is only the problem of the remaining tab in the navigation pane on the left.

I still tried some things like auto-sync on/off when compiling the help - but in the context of your question without success.

Now I only have the idea to open the help window additionally with the call for the table of contents and to synchronize to the context ID only afterwards (see code below).

The double operation will probably not be noticed by the user of the program.

I would not recommend switching to Microsoft Help2 for application help.

  Private Sub btnOpenHelpContextId02_Click(sender As Object, e As EventArgs) Handles btnOpenHelpContextId02.Click
    Dim strContextID As String
    strContextID = "20010"
    ' --- Open help file - Table of contents (next line inserted only to reset navigation pane to TOC (fix tab issue))
    Help.ShowHelp(Me.btnOpenHelpContextId02, HelpProvider1.HelpNamespace, HelpNavigator.TableOfContents)
    ''--- Show CHM contents tab and a special topic by TopicID -----
    Help.ShowHelp(Me.btnOpenHelpContextId02, HelpProvider1.HelpNamespace, HelpNavigator.TopicId, strContextID)
  End Sub

CodePudding user response:

  1. The last activated tab in the left panel remains activated, so it won't jump to Contents (Sommaire in your case).

  2. If another topic was selected earlier in Contents, and the help file was closed, then when the help file is reopened by Help.ShowHelp and you want to open the topic ID 6, the previous topic was still selected in Contents. It seems to be a bug of Microsoft HTML Help viewer.

If the help file remains opened, then followup calls of Help.ShowHelp should jump to the correct topics and Contents also show correct topics being selected.

Overall, you should accept such limitations or abandon HTML Help (CHM) as Microsoft abandoned it in 2002, two decades ago.

  •  Tags:  
  • Related