This documentation is archived and is not being maintained.

Help Files Sample

Visual Studio 2008

This sample shows how to add Help to a Windows-based application using the ToolTip, HelpProvider, and ErrorProvider controls.

To get samples and instructions for installing them

  • Do one or more of the following:

    • On the Help menu, click Samples.

      The Readme displays information about samples.

    • Visit the Visual Studio 2008 Samples Web site. The most recent versions of samples are available there.

    • Locate samples on the computer on which Visual Studio is installed. By default, samples and a Readme file are installed in drive:\Program Files\Microsoft Visual Studio 9.0\Samples\lcid. For Express editions of Visual Studio, all samples are located online.

For more information, see Visual Studio Samples.

Security noteSecurity Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To run this sample

  • Press F5.

Each tabbed page of the TabControl displays a different type of help:

  • ToolTip   A ToolTip component is added to the form. This adds the ToolTip1 property to each control on the form.

  • PopUp   A HelpProvider component named hpAdvancedCHM is added to the form. This adds the Help String on hpAdvancedCHM property to each control which is set with a Help string. The ShowHelp on hpAdvancedCHM property is also added to each control, and is set to True. The HelpButton property of the form is set to True to display the question mark button in the corner next to the close button. The minimize and maximize buttons have to be turned off for the Help button to appear.

  • HTML Help   A HelpProvider component named hpAdvancedCHM is added to the form. This adds the HelpKeyword on hpAdvancedCHM, HelpNavigator on hpAdvancedCHM, and ShowHelp on hpAdvancedCHM properties to each control. The ShowHelp on hpAdvancedCHM property is set to True. The compiled Help file is open to the Help page with the specified keyword. The HelpButton property of the form is set to True to display the question mark button in the corner next to the close button. The minimize and maximize buttons have to be turned off for the Help button to appear.

  • Error Provider   The ErrorProvider component is used to show how to give the user visible warning on a control that does not validate to the correct data type.

Show: