?
Solved

VS 2005 .NET helpProvider and .chm syntax?

Posted on 2008-02-08
5
Medium Priority
?
1,690 Views
Last Modified: 2012-06-27
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&&..
0
Comment
Question by:kvnsdr
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:help-info
ID: 20856778
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
 
LVL 7

Expert Comment

by:help-info
ID: 20856805
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
 
LVL 1

Author Comment

by:kvnsdr
ID: 20857429
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
 
LVL 7

Accepted Solution

by:
help-info earned 2000 total points
ID: 20862252
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
 
LVL 1

Author Comment

by:kvnsdr
ID: 20871728
Also, I found your example about 'anchor' especially helpful...

@"/HTMLHelp_Examples/jump_to_anchor.htm#AnchorSample

Thanks again...
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question