In this article we will learn how to use
HelpProvider control in a windows forms application using Visual Studio 2010.
HelpProvider control
This control provides pop-up or on line help
for controls. HelpProvider control Provides help with your application is very
useful as it allows your users to understand it more easily, thereby increasing
productivity and saving some money. Support for help in Visual Basic exists and
you can display HTML files that can contain a set of linked topics.
Help class:
The Help class allows us to display HTML help
to users. The Help class provides two methods: ShowHelp and ShowHelpIndex.
ShowHelp - ShowHelp is used to display a
help file for a particular control and requires that control to be displayed
along with the help file. The URL you specify for the help file can be in the
form of F:\myHelp (local machine) or http:\\www.vbheaven.com\help.htm (Web).
ShowHelpIndex -ShowHelpIndex method is
used to display the index of a specified help file. You call the ShowHelpIndex
method just like you call the ShowHelp method.
Example:
Drag a button and level on the form.

Figure 1.
Now double click on the button and add
following code displays a help file and have a named myhelp.htm in the F: drive
of your machine.
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs)
Handles Button1.Click
Help.ShowHelp(Label1,
"F:/myhelp.htm")
End Sub
Now click on button myhelp.htm file will be display
or select label control press F1 for help.
HelpProvider Component:
The HelpProvider component provides these
additional properties to each control on the form. These properties are:

Figure 2.
HelpString - Determines the help string
associated with a control.
HelpKeyWord - Determines the help
keyword associated with a control.
HelpNavigator - Determines the kind of
help associated with a control. Provides six values: TableOfContents, Find,
Index, Topic, AssociatedIndex and KeywordIndex.
ShowHelp - Determines if help should be
displayed for this control.
Example:
Using the property display a help on the button
when we press F1.
Firstly set two property of the The
HelpProvider component provides these additional properties to button.
ShowHelp on Helpprovider1 -> True
HelpString on HelpProvider1 -> write some
string which will be display for help string such as please press the button.

Figure 3.
The following code displays a help string when
Button2 has the focus and F1 key is pressed.
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As
System.EventArgs) Handles MyBase.Load
HelpProvider1 .SetHelpString (Button1 , "I am
supported by HelpProvider");
End Sub
The image below displays output from code
above.

Figure 4.