This is a mirror of official site: http://jasper-net.blogspot.com/

HelpProvider in C#

| Monday, August 30, 2010
HelpProvider

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);
}

Read more: C# Corner

Posted via email from .NET Info

0 comments: