Implement Context Sensitive .chm help in C#

I have another question out there with no answer yet.  The other question is Showing Help .chm and Topic ID.  
I need sample code to successfully implement a .chm help file into a C# program.  When users click a button, I detect what form is currently active and then want to launch the help file Topic ID associated with the form.
I have two questions, both are worth 500 points.  Put the correct answer in both questions and it will be worth 1000 points.
SheritlwAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gbzhhuCommented:
I am not sure that you are alllowed to ask 2 same questions in the hope of giving more points to experts.  It doesn't mean that much to me as I am not after points :-)

Have a read at these

http://www.helpscribble.com/dotnet.html

This one is for VB but I think there is not much code involved when setting up context sensitive help

http://support.microsoft.com/default.aspx?scid=kb;en-us;821777

Good luck
0
gbzhhuCommented:
Sorry, the first url requires that you buy a product.  I didn't notice it before.  If you have a .chm file ready I can try to implement the c# code if you send me the help file.  post it to ee-stuff
0
SheritlwAuthor Commented:
What is ee- stuff?
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

SheritlwAuthor Commented:
I found the ee-stuff and uploaded the eQualify.chm
Thanks so much for your help
0
gbzhhuCommented:
You need to post the url of where you posted the file so I can get it.  Plus I am going home now it 18:05 here, will carry on tomorrow though.
0
SheritlwAuthor Commented:
ok, will look at it.  
Thanks again
0
gbzhhuCommented:
I have time now to try this.  Can you post the url, otherwise let me know if you have found an answer in the other question.
0
SheritlwAuthor Commented:
I couldn't figure out the URL.   I uploaded the file with the title of the project Implement Context Sensitive .chm help in C#.  I was going to upload another one, but couldn't see where I could get the URL.  
I have not found a solution, although I've been trying for days.  If you have any idea on how to upload and get the URL, I will do again.
Thanks,
Sheri
 
0
gbzhhuCommented:
When you upload the file, the URL should be in the Browser address box - I think - I haven't done this for awhile.
0
gbzhhuCommented:
I tried searching but I can't find your file.  try logging into ee-stuff, do you get list of files you uploaded?
0
SheritlwAuthor Commented:
There is a file there, but it is not mine or from my user name.  Can I email the file to you?
Sheri
0
gbzhhuCommented:
sure hassan dot hussain at dbt dot co dot uk

Let me have some topic numbers too to test
0
SheritlwAuthor Commented:
sent, did you get?
0
gbzhhuCommented:
Got it, working on it.
0
SheritlwAuthor Commented:
great thanks.  It's 4 here so I am going to get some sleep.  
Thanks again
Sheri
0
gbzhhuCommented:
Don't yet.  I have an answer for you

0
gbzhhuCommented:
It is simple!  no need for help provider or all that.

In your button click just add this

            Help.ShowHelp(this, @"C:\Solutions\eQualify.chm", HelpNavigator.TopicId, "1030");

And that is it.  Just change the path to file to your correct path and the 1030 topic id for the correct topic
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SheritlwAuthor Commented:
You are great!!!
This is what I've got thus far.
 
string sPath;
      sPath = Application.StartupPath + "\\eQualify.chm";
      Help.ShowHelp(this, @sPath, HelpNavigator.TopicId, "1030");

Now how do I tell in a MDI application what form has focus or should I make another question?

Sheri
0
gbzhhuCommented:
Sorry, was not at work and still not.  What you need is

this.ActiveMdiChild

See explanation here

http://msdn2.microsoft.com/en-us/library/4s6dtf7z(VS.80).aspx
0
gbzhhuCommented:
If I understand your problem correctly, maybe you should have a method like this

0
gbzhhuCommented:
 In your MID Parent form put the method below then in your button click you can replace
Help.ShowHelp(this, @sPath, HelpNavigator.TopicId, "1030");

with

Help.ShowHelp(this, @sPath, HelpNavigator.TopicId, GetActiveFormTopicID);
   

        private string GetActiveFormTopicID()
        {
            if (this.ActiveMdiChild != null)
            {
                switch (this.ActiveMdiChild.Name)
                {
                    case "Form2": return "200";
                    case "Form3": return "300";
                    default: return string.Empty;
                }
            }
            else
                return string.Empty;
        }
0
gbzhhuCommented:
You will obviously channge Form2 and Form3 etc to your actual form names.  you could use form caption/text instead of form name.
0
gbzhhuCommented:
Don't know if you still have a problem with this but I noticed that in my comment

Help.ShowHelp(this, @sPath, HelpNavigator.TopicId, "1030");
should be
Help.ShowHelp(this, sPath, HelpNavigator.TopicId, "1030");

and

Help.ShowHelp(this, @sPath, HelpNavigator.TopicId, GetActiveFormTopicID);
should be
Help.ShowHelp(this, sPath, HelpNavigator.TopicId, GetActiveFormTopicID);

Remove the @ character
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.