HelpProvider Control with HelpClass in VB.NET

In this article we demonstrate on what is HelpProvider control and HelpClass and also the additional properties the HelpProvider control provide to other control when add to a form
  • 2976
Download Files:
 

A visual basic HelpProvider control allow us to provide help for controls on the form when F1 key is pressed. The HelpProvider control is extender which means that it coordinates and maintains properties for each controls on the form. Notable property of HelpProvider control is HelpNameSpace property which specifies the URL for the help file associated with it. The HelpProvider control Provide three additional properties to each control on the form.


Properties of HelpProvider Control:-

  • HelpString:- This property shows help string associated with a control. 

  • HelpKey:- This property shows help keyword associated with a control

  • HelpNavigator:- This property shows the kind of help associated with a control.
     

HelpClass:-

HelpClass allow you to display a HTML help to user. HelpClass provide two methods ShowHelp and ShowHelpIndex. Here we are showing an example of HelpProvider control with HelpClass file. In which you have two Buttons, a Label, HelpProvider control and one work. Html file in c drive of your system.The below code display a help string when Button2 has the Focus and F1 key pressed and a help file when Button1 is clicked.

  • Open a new Project. 

  • Drag Two Buttons, a Label and a HelpProvider Control on form, the form will look like given below.
    HelpProvider.gif
    HelpProvider2.gif

     

  • Write the below code on form load and Button click.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As  _
            System.EventArgs) Handles MyBase.Load
            HelpProvider1.SetHelpString(Button2, "I am supported by HelpProvider1")
            'button2 needs to have focus to display this string when F1 is pressed
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e_ As System.EventArgs) Handles
           
    Button1.Click
            Help.ShowHelp(Label1, "C:\work.htm")
            'using the Help class with label control
        End Sub

    Output:-
    HelpProvider3.gif

  • HelpProvider4.gif
    HelpProvider5.gif

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.