.netvb.netchm

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


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?


Solution

  • Found the reason of this strange behaviour: the chm files that i called was not local but stored on a professionnal private network. To fix the problem, i copy the file in a local Path that I create.

    Here's my code to manage the chm file from "not local" to "local"

        Private Sub HelpFileManagement()
            ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            '''                               Manage the Help File Storage                               '''
            '''  1) Check if the local folder FOLDER1 "C:\Users\USERNAME\Documents\MyAppName" exist. If not, the folder is created
            '''  2) Check if there is a MyAppName-help.chm in FOLDER1 . If not, the file is copied from the network folder to FOLDER1
            '''  3) If there is already a file, check last modification date between the local file and the network file
            '''  
            Dim strHelpFolder As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\MyAppName\"
            Dim dirHelpFolder As DirectoryInfo
            Dim strHelpFileName As String = "MyAppName-help.chm"
            Dim strHelpSourceFile As String = System.IO.Path.Combine(Application.StartupPath, "MyAppName-help.chm")
            Dim dateSourceHelpFile As DateTime
            Dim dateCurrentHelpFile As DateTime
            Dim strMsgException As String = "Problème dans la gestion du fichier d'aide." & vbCrLf & strMsgErrorTellYourAdmin
    
            Try
                '1)
                If Directory.Exists(strHelpFolder) = False Then
                    dirHelpFolder = Directory.CreateDirectory(strHelpFolder)
                End If
                strPathHelp = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\Dumbow\"
                strPathHelpFile = System.IO.Path.Combine(strPathHelp, "Dumbow2-help.chm")
    
                '2)
                If File.Exists(System.IO.Path.Combine(strHelpFolder, strHelpFileName)) = False Then
                    File.Copy(strHelpSourceFile, System.IO.Path.Combine(strHelpFolder, strHelpFileName))
                Else
                    '3)
                    dateSourceHelpFile = File.GetLastWriteTime(strHelpSourceFile)
                    dateCurrentHelpFile = File.GetLastWriteTime(System.IO.Path.Combine(strHelpFolder, strHelpFileName))
                    If dateSourceHelpFile <> dateCurrentHelpFile Then
                        File.Copy(strHelpSourceFile, System.IO.Path.Combine(strHelpFolder, strHelpFileName), True)
                    End If
                End If
    
            Catch ex As Exception
                MsgBox(strMsgException & vbCrLf & ex.Message, MsgBoxStyle.Information, strMsgBoxGeneralErrorTitle)
                Exit Try
    
            End Try
    
        End Sub