Click here to Skip to main content
13,407,694 members (51,958 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


8 bookmarked
Posted 7 Mar 2011

HelpButton: A Button Linked to a Topic of a chm Help File

, 8 Mar 2011
Rate this:
Please Sign up or sign in to vote.
When clicked, this button shows the application help file and displays its topic page.


A few months ago, my company asked me to add a help file to our application. And of course, they wanted the different sections to be easily reached by the user.

To reach the different sections from the main application, I thought that the classical question mark inside the title window bar (Form.HelpButton) would be enough but they wanted something easier for the real newbie. They told me that first clicking the help button, then clicking the control was not intuitive enough :(...

So I designed a very simple button: clicking that button would just display a topic from the help file. Nothing complicated there, but everybody was happy with that and it seems that the customers feedbacks were quite good as well.


So I thought maybe some of you could be interested even though there is nothing complicated there.

To make the help file, I used HTML Help Workshop. I created several topics with their IDs so I could reach them from code. The aim of this article is not to explain how to create help files, I will suppose that you already have one.

Using the Code

After referencing the Help.dll assembly, all you need is to initialize the chm file path (will be the same for every buttons):
Help.HelpButton.HelpFile = Application.StartupPath + "\\sample.chm";

Drop as many HelpButtons as you want inside your forms, and for each button set the Value property to the topic ID you want.

If you prefer to directly reference an HTML page or any of the HelpNavigator values, you may use the Style property of the button.

The last useful property is BigSize: you can choose whether you want a small (16x16) or large (32x32) icon for the question mark.

I hope some of you will find this control useful.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

You may also be interested in...


Comments and Discussions

Questionthank you. Pin
datdit27-Oct-14 5:25
memberdatdit27-Oct-14 5:25 
GeneralMean instead of application path we have to set the director... Pin
Dorababu7437-Mar-11 22:48
memberDorababu7437-Mar-11 22:48 
GeneralRe: Yes. When you deploy your application, if the user selects f... Pin
Olivier Levrey7-Mar-11 22:57
memberOlivier Levrey7-Mar-11 22:57 
GeneralGood one i tested your code it's working fine Pin
Dorababu7437-Mar-11 22:43
memberDorababu7437-Mar-11 22:43 
GeneralWill that CHM will be opened if i have it any where accordin... Pin
Dorababu7437-Mar-11 22:39
memberDorababu7437-Mar-11 22:39 
GeneralRe: "all you need is to initialize the chm file path". It means:... Pin
Olivier Levrey7-Mar-11 22:42
memberOlivier Levrey7-Mar-11 22:42 
GeneralThis will search for the Help File if it is in Application d... Pin
Dorababu7437-Mar-11 18:36
memberDorababu7437-Mar-11 18:36 
GeneralRe: This line of code was just an example. You can of course put... Pin
Olivier Levrey7-Mar-11 22:35
memberOlivier Levrey7-Mar-11 22:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02-2016 | 2.8.180212.1 | Last Updated 8 Mar 2011
Article Copyright 2011 by Olivier Levrey
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid