ARTICLE

HelpProvider control in a Windows Forms application using Visual Studio 2010

Posted by Rohatash Kumar Articles | Visual Basic 2010 October 28, 2010
in this article we will learn how to use helpprovider control in a windows forms application using Visual Studio 2010.
 
Reader Level:

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.

helpp1.gif

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:

helpp2.gif

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.

helpp3.gif

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. 

helpp4.gif

Figure 4.

Login to add your contents and source code to this article
share this article :
post comment
 

I am using EMbedded Visual C++ 3.0 and PegHElp.exe to launch Online HElp on an application that was built for Windows mobile 5.0 Pocket PC. The same applicaton owrks fine on Embedded HAndHeld 6.5, the online Help also launches fine. But there is no Close button on the Help windo. So basically I cannot close the Online HElp. Any idea? THanks, Usha

Posted by Usha Kuloor Jan 30, 2012
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor