3

I want to connect a help file(.chm) to my windows application. How do I can do this? Thanks.

Tavousi
  • 14,848
  • 18
  • 51
  • 70

4 Answers4

5

Try this

string fbPath = Application.StartupPath;
string fname = "help.chm";
string filename = fbPath + @"\" + fname;
FileInfo fi = new FileInfo(filename);
if (fi.Exists)
{
Help.ShowHelp(this, filename, HelpNavigator.Find, "");
}
else
{
MessageBox.Show("Help file Is in Progress.. ",MessageBoxButtons.OK, MessageBoxIcon.Information);

}
3

Use the Help.ShowHelp method for doing it on button presses etc:

private void button1_click(object sender, EventArgs e)
{
      string helpfile = "C:\MyHelp.chm";
      Help.ShowHelp(this, helpfile, mypage.htm);
}

and to link your help via the F1 key see this guide for a detailed explanation on how to do this:

http://www.dotnetspark.com/kb/162-open-help-file-on-f1-function-key-press.aspx

Iain Ward
  • 9,850
  • 5
  • 34
  • 41
2

You can use Help.ShowHelp.

One example from the MSDN page:

private void Button1_Click(System.Object sender, System.EventArgs e)
    {

        Help.ShowHelp(TextBox1, "file://c:\\charmap.chm");
    }

You can also check out these SO pages:

Community
  • 1
  • 1
C-Pound Guru
  • 15,967
  • 6
  • 46
  • 67
1

For Winforms, the excellent Windows Forms Programming provides a very nice overview (chapter 3, implementing help). Some pointers:

Ohad Schneider
  • 36,600
  • 15
  • 168
  • 198