I have a help file (.chm), and I want to be able to perform a seemingly simple operation of having that file open when the user selects "Contents" from the "Help" menu. I have added the proper object to the project and set it's namespace property to the location of the file. The problem is, I can't find anything that explains how to bind this to the control. I can't find anything in the help file (C# Express) on how to actually write the code that makes this happen.

I'm also wondering if there's more than one way to do this.

Dani AI

Generated

As found, launching a CHM from a Help menu is straightforward, but there are a few common variants and deployment pitfalls worth calling out for anyone arriving here later (thanks also to and for the pointers in the thread).

A few practical patterns (different needs call for different overloads):

  • Open a specific topic inside the CHM:
string helpFile = Path.Combine(Application.StartupPath, "MyAppHelp.chm");
Help.ShowHelp(this, helpFile, HelpNavigator.Topic, "getting_started.htm");
  • Let Windows pick the viewer (simplest when only a fileopen is needed):
Process.Start(Path.Combine(Application.StartupPath, "MyAppHelp.chm"));

Context-sensitive help using a HelpProvider is often more useful than a single Contents item. Example setup (set HelpProvider.HelpNamespace at startup, then attach per-control help):

helpProvider1.HelpNamespace = Path.Combine(Application.StartupPath, "MyAppHelp.chm");
helpProvider1.SetHelpNavigator(textBox1, HelpNavigator.Topic);
helpProvider1.SetHelpKeyword(textBox1, "topics/inputfields.htm");

Common deployment and troubleshooting tips:

  • Mark the CHM as Content and "Copy if newer" so it ships with the EXE.
  • Windows will show a blank CHM if the file is "blocked" (downloaded from the Internet) or on a network share; right-click -> Properties -> Unblock, or copy locally for testing.
  • For F1 behavior, enable KeyPreview or handle HelpRequested/ProcessCmdKey and call the appropriate Help.ShowHelp overload.
  • For modern apps or cross-platform requirements, consider migrating away from .chm to web-based help or a packaged HTML viewer.

These additions complement the simple menu call shown earlier and address context-sensitive help, topic targeting, and real-world deployment issues.

Recommended Answers

All 3 Replies

OK, I found it. Pretty simple thing really, as I kind of felt it would be. While I'm sure most of you already know it, just to be prudent and fair, here's the code:

private void MenuItem_Click(object sender, EventArgs e)
        {
            Help.ShowHelp(this, HelpProvider.HelpNamespace);
        }

Now I found this by posting a question on the Microsoft VS forum, and someone directed me to a site called http://www.helpware.net . Interesting place really.

Now, if I can just get this database thing figured out. . . .

Yeah I hear you on the database thing, also thanks for the info as it saved me lots of trouble :)

HI,
try this link

Pankaj

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.