We help IT Professionals succeed at work.

Showing Help .chm and TopicID

Sheritlw
Sheritlw asked
on
Hi,
I am VERY new to C# and am trying to implement my help files into this program.  In vb6 i just referenced the help file location when the program started and then for each help button referenced the topic ID.
I have looked on MSDN, but it's all greek to me.  Does anyone have an easily understandable example of how to implement help within a C# program?
Thanks,
Comment
Watch Question

Author

Commented:
Hi,
I have studied the link and tried implementing according to the .Net 1 instructions (although I use version 2 framework) with no luck.
Again I am very new to C# and this program is already coded, so I don't even know where to put the information.  
I added the HelpProvider to the form and tried putting the lines in that link all over the place, but kept getting errors.
I need an example (no more links please) of where to put things, (very different than vb6) .  For example, what part of the code does the namespace get referenced?  
Also the example provided in the link for a .chm file is for hooking up to a button or dialog.  I have a button on each form and contextIDs that relate to each for within my help file.  I need to know how to hook it up to show the context id from the help file.
Thanks,

to make it simple for you
follow these line of codes
// get environment variable representing the Windows folder
String s = Environment.GetEnvironmentVariable("windir");
// set h to WindowsPath\Help\helpfile  here you need to put chm file
String h = s + "/Help/MyHelpFile.chm";
now below code line should be put on button event in that event, check your contextid or whatever condion on that condition change the file name written below
Help.ShowHelp(this, HelpProvider1.HelpNamespace);
or
Help.ShowHelp(this, HelpProvider1.HelpNamespace);
The HelpProvider component can be dragged on to your Windows Form from the Toolbox. It will likely be automatically named HelpProvider1. I normally change it to something like hlpPrvMain or anything more appropriate and on the mark. The only really relevant property you need to set at design-time is the HelpNamespace property, which holds a string value representing the path to the HTMLl Help source file. The source file may be any .htm or .chm file.

Author

Commented:
I have set the namespace property, but am having difficulty setting the the contextid.
I have one help button but will detect which form is active and then specify which context id to use.
I keep getting errors and don't have any properties available for help to navigating to the correct context id.
This is what I have started with.
if (AddEmpForm.ActiveForm)
      {
        this.helpProvider1 ???= "html\\1150.htm";
      }

Author

Commented:
Anyone know about implementing a .chm file in C#