Question

I'm struggling with some code and cannot see what is the problem. I cannot load embedded chm help file from resources in project, but on some "remote" path it works flawlessly.

        private void help_Click(object sender, EventArgs e)
        {
          //System.Windows.Forms.Help.ShowHelp(this,"file://C:\\Users\\user\\Desktop\\htmlCHM\\Administration.chm", "DodavanjeKorisnika.htm");
            System.Windows.Forms.Help.ShowHelp(this, "ICTSIbilling.Resources.Administration.chm", "DodavanjeKorisnika.htm");
        }

path should be correct

if you see the path on solution explorer for Administration.chm is under ICTSIbilling.Resources.Admininistration.chm

what I did wrong?

Was it helpful?

Solution 2

I found another solution that works for me and I wish to share with others that are planning to implement similar thing. First I have created folder "Files" in which I have placed .chm file. after that I have used Directory class to get current directory:

        private void help_Click(object sender, EventArgs e)
        {
            path = Directory.GetCurrentDirectory();
            //izmjeniti htm naziv file
            System.Windows.Forms.Help.ShowHelp(this, "file://" + path + "\\Files\\Administration.chm", "DodavanjeKorisnika.htm");
        }

After I have done this part, I have added chm file into Folder directory, and in VS I have click chm file, and choose: Build Action "Content" and Copy to Output Directory: "Copy always". Add CHM into project - installation directory

Basically this should work for everyone because, while deploying app with One Click Deploy, it will create/copy Folder structure with chm file, plus using method get current directory and concatenate it with that folder and file, you provide necessary path to this file...

Cheers :)

OTHER TIPS

ShowHelp needs a URL to pass to the external Windows Help Viewer application, you cannot pass it the name of an arbitrary resource identifier in your binary and expect it to be able to do anything.

Ship the chm separately (so people can also run it independently).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top