VS 2005 .NET helpProvider and .chm syntax?

Im still having problems trying to get the proper string for the VS2005 HelpProvider to open the appropriate Topic.

Heres what Ive been using, but it always opens the .chm in the Keyword Index and never the TOC along with my topic.

Doesnt matter if I use the Whats this Help Button or selecting a control and pressing F1&

this.helpProvider1.HelpNamespace = "Help\\myhelp.chm";
this.helpProvider1.SetHelpKeyword(this.checkBox1, "Network_Activity/featuretabs.htm");
this.helpProvider1.SetHelpNavigator(this. checkBox1, System.Windows.Forms.HelpNavigator.Topic);

Ive been all over the Internet and have learned to use an underscore in the topic name.

Else, Im getting nowhere..

Help&&..
LVL 1
kvnsdrAsked:
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.

help-infoCommented:
I'm not a C# programmer but what I see is a double backslash (I think single backslash is better) in your HelpNamespace property.

I added some slashes - see code snippet below (not tested).

You maybe interested in a ClickOnce example from my site:

HTH
Best regards
Ulrich Kulle
Microsoft MVP - Windows Help
***********************************
http://www.help-info.de
***********************************
private const string sHTMLHelpFileName = "Help\myhelp.chm";
 
private void Form1_Load(object sender, System.EventArgs e)
{
	// set F1 help topic for this form
	helpProvider1.HelpNamespace = Application.StartupPath + @"\" + sHTMLHelpFileName;
	helpProvider1.SetHelpNavigator(this, HelpNavigator.Topic);
	helpProvider1.SetHelpKeyword(this, @"/Network_Activity/featuretabs.htm");
}
 
private void button2_Click(object sender, System.EventArgs e)
{
	// open Table of Contents
	Help.ShowHelp(this, helpProvider1.HelpNamespace, HelpNavigator.TableOfContents);
}
 
private void button3_Click(object sender, System.EventArgs e)
{
	// open help topic
	string sTopic = helpProvider1.HelpNamespace + @"::/Network_Activity/featuretabs.htm";
	Help.ShowHelp(this, helpProvider1.HelpNamespace, sTopic);
}

Open in new window

0
help-infoCommented:
oooh - forgot URL ;-)
http://www.help-info.de/en/Visual_Basic_2005/vb_2005.htm
See:
http://www.help-info.de/publish/VB2005_CHM/publish.htm
After the example application starts go to tab "HTMLHelp", set focus to "Topic" button and press F1.

I use the attached properties for this button.

HTH
Best regards
Ulrich Kulle
Microsoft MVP - Windows Help
***********************************
http://www.help-info.de
***********************************




property-help.png
0
kvnsdrAuthor Commented:
I use VS2005 English and tried all the advice given above, but still could not get it to work.

VS2005 only has 1 HelpNavigator showing in the GUI where your's show 2.

Maybe that's why your method works for you and not me?

The author of HelpMatic Pro HTML got it to work using the TopicId and the help file Topic 'Context No:' like this...

HelpProvider1.SetHelpKeyword(Button1, "9")
HelpProvider1.SetHelpNavigator(Button1, HelpNavigator.TopicId)

Every Topic (mytopic.htm) is given a 'Context No:' (unique number, ie... 12) and this way each topic is pinpointed.

Next problem is finding a bookmark within the Context No:??????




0
help-infoCommented:
Note that some information of a CHM viewer window is saved inside the hh.dat file. The last opened tab is saved too and it seems to me "Index" tab is opened when an F1 error occurs (means a error while developing). You can delete this hh.dat file - it's recreated by system (this is really annoying). See:
http://www.help-info.de/en/xml/maml_faq.xml#HTMLHelp > third topic

I have seen the error with index tab you described too. One thought is you also can switch to the "Contents" tab after calling from your application and close the help viewer window. So the last opened "Contents" tab is saved to the hh.dat file.

Of course it is possible to compile TopicID's into a CHM. But have a look at the attached C# code example. This may work for you. I installed C# Express beside Visual Basic on my machine and I'm really a C# programmer now - LOL ;-)

It's just quick and dirty code but anchor jumps are included ..
See uploaded project:
http://www.help-info.de/download/CSharp_CHM.zip

HTH
Best regards
Ulrich Kulle
Microsoft MVP - Windows Help
***********************************
http://www.help-info.de
***********************************



        private void Form1_Load(object sender, EventArgs e)
        {
            // set F1 help topics for this form
            helpProvider1.HelpNamespace = Application.StartupPath + @"\" + sHTMLHelpFileName;
            helpProvider1.SetHelpNavigator(this, HelpNavigator.Topic);
            helpProvider1.SetHelpKeyword(this, @"/Garden/garden.htm");
            helpProvider1.SetHelpNavigator(this.btnStart, HelpNavigator.Topic);
            helpProvider1.SetHelpKeyword(this.btnStart, @"/Garden/flowers.htm");
            helpProvider1.SetHelpNavigator(this.btnExit, HelpNavigator.Topic);
            helpProvider1.SetHelpKeyword(this.btnExit, @"/Garden/tree.htm");
            helpProvider1.SetHelpNavigator(this.chkMain, HelpNavigator.Topic);
            helpProvider1.SetHelpKeyword(this.chkMain, @"/HTMLHelp_Examples/jump_to_anchor.htm#AnchorSample");
        }

Open in new window

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
kvnsdrAuthor Commented:
Also, I found your example about 'anchor' especially helpful...

@"/HTMLHelp_Examples/jump_to_anchor.htm#AnchorSample

Thanks again...
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.