Associate chm help file with F1 key

  • Thread starter Thread starter Doug
  • Start date Start date
D

Doug

Hi

I have my applicaiton ready to roll - and a help file compiled that I can
bring up with a help menu item. But how can I make the help file apear when
I press the F1 key?

The menu item event uses:
private void helpaHelpToolStripMenuItem_Click(object sender, EventArgs e)

{

Help.ShowHelp(this,helpfile);

}



Thanks



Doug
 
bring up with a help menu item. But how can I make the help file apear when
I press the F1 key?

First you need to place HelpProvider component on your form from the
toolbox.

Then you need to set two properties on each control for which you want
F1 help:
1. HelpKeyword property to HTML file name of the topic to be opened in
your compiled CHM file, e.g. myTopic.htm
2. HelpNavigator property to "Topic".

Don't forget to specify the absolute full path to the CHM file on
program startup. Note that the system doesn't look in application's
folder. Use something like:
HelpProvider1.HelpNamespace = IO.Path.Combine(appPath, "myHelpFile.chm");

and use System.Reflection.Assembly.GetExecutingAssembly.Location to get
appPath.
 
Thanks Peter

how can i use

System.Reflection.Assembly.GetExecutingAssembly.Location to get the appPath.

I tried string appPath=
System.Reflection.Assembly.GetExecutingAssembly.Location; but I get an error
for that code.

Doug
 
string directory =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

Remember the path will look like this: "file:\c:\path\path", so you will
have to remove the "file:\".
 
I tried string appPath=
System.Reflection.Assembly.GetExecutingAssembly.Location; but I get an error
for that code.

You probably need to add parentheses after GetExecutingAssembly as it is
a method. I forgot to add them.
System.Reflection.Assembly.GetExecutingAssembly().Location
 
Back
Top