HelpProvider control in VB.NET

HelpProvider control provides popup or online help for a control. In this article, we will discuss how to use a HelpProvider control to implement help for controls in a Windows Forms application.
  • 10350
 

HelpProvider control provides popup or online help for a control.  In this article, we will discuss how to use a HelpProvider control to implement help for controls in a Windows Forms application.

Here are some of the useful methods of HelpProvider.

SetShowHelp method specifies whether Help is displayed for the specified control.

SetHelpString method specifies the Help string associated with the specified control.

SetHelpNavigator method specifies the Help command to use when retrieving Help from the Help file for the specified control.

SetHelpKeyword method specifies the keyword used to retrieve Help when the user invokes Help for the specified control.

HelpNamspace property gets or sets a value specifying the name of the Help file associated with this HelpProvider.

Here is an example of how to use a HelpProvider component and load a help (.chm) file and apply on the controls.

C# Code:

private HelpProvider hlpProvider;

 

private void CreateHelpProvider()

{

    hlpProvider = new System.Windows.Forms.HelpProvider();

    hlpProvider.SetShowHelp(textBox1, true);

    hlpProvider.SetHelpString(textBox1, "Enter a valid text here.");

 

    hlpProvider.SetShowHelp(button1, true);

    hlpProvider.SetHelpString(button1, "Click this button.");

 

    // Help file

    hlpProvider.HelpNamespace = "helpFile.chm";

 

    hlpProvider.SetHelpNavigator(textBox1, HelpNavigator.TableOfContents);

 

}

 

VB.NET Code:

Private Sub CreateHelpProvider()

        Dim hlpProvider As HelpProvider

        hlpProvider = New System.Windows.Forms.HelpProvider()

        hlpProvider.SetShowHelp(TextBox1, True)

        hlpProvider.SetHelpString(TextBox1, "Enter a valid text here.")

 

        hlpProvider.SetShowHelp(Button1, True)

        hlpProvider.SetHelpString(Button1, "Click this button.")

 

        ' Help file

        hlpProvider.HelpNamespace = "helpFile.chm"

        hlpProvider.SetHelpNavigator(TextBox1, HelpNavigator.TableOfContents)

    End Sub

 

Summary
In this article, we discussed discuss how to use a HelpProvider control.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.