vb.netchmhelpfile

Clicking on a button to display .CHM help file in VB.NET


I want to display a .CHM help file when clicking on a button in VB.NET. Could anyone show me code how to do this?

Private Sub cmdHelp_Click(ByVal sender As System.Objects, Byval e As System.EventArgs)Handles cmdHelp.Click
   'Please help provide some code
End Sub

Solution

  • Doing a Process.Start with a verb of open does the trick:

    Module Module1
    
        Sub Main()
            Dim p As New Process()
            Dim psi As New ProcessStartInfo("path to my CHM file")
            psi.Verb = "open"
            p.StartInfo = psi
            p.Start()
    
            Console.ReadKey()
        End Sub
    
    End Module
    

    Note that .chm files are heavily restricted by the OS from about WinXP SP3 (SP2?) onwards - they are considered to be a reasonble security risk, so you can't open them directly from a network or remote location. You will need to code accordingly, and expect exceptions when trying to open them.