HelpProvider Control Use

This C# article describes the HelpProvider control in Windows Forms.

HelpProvider. The HelpProvider control offers contextual help dialogs.

Sometimes a user wants a verbose description of a control. With HelpProvider we provide this description by adding a Help button and setting some properties.

 

 

Steps. Before we use the HelpProvider control, let's add the help button in the top right corner of the window. It has a question mark on it. Change the HelpButton property to True on the Form.

 

Note: Change the MaximizeBox and MinimizeBox properties to False. This is a necessary step.

Tip: The HelpButton will not show up if the maximize or minimize buttons are enabled.

Add HelpProvider. Next we need to add the HelpProvider control to the form. Open the Toolbox and double-click on HelpProvider. The main effect this will have is all controls will have new properties on them.

Properties:

HelpKeyword   on helpProvider1
HelpNavigator on helpProvider1
HelpString    on helpProvider1
ShowHelp      on helpProvider1

Set HelpString. The HelpProvider is activated upon the user clicking on the Help button and then clicking on a Control. So, to continue with the tutorial, add a Button control to your Windows Form.

Then: Change the "HelpString on helpProvider1" property to have any message you like.

Test HelpString. Now, when you click on the Help button in the top right of the Form, and then click on the Button, the HelpProvider will display a box with a shadow. The HelpString will be displayed inside this box.

 

Summary. We used the HelpProvider control to provide contextual help in a Windows Forms program. By adding the Help button and then setting the HelpString property that is offered by the HelpProvider instance, a help mode is enabled.