Share via


Visual Basic Concepts

Adding Support for What's This Help

Visual Basic allows you to easily add What’s This Help to your applications. What's This Help provides quick access to Help text in a popup window without the need to open the Help viewer. It is typically used to provide simple assistance for user interface elements such as data entry fields. Visual Basic supports What's This Help topics in both WinHelp (.hlp) and HTML Help (.chm) files.

Setting the WhatsThisHelp property of a form to True enables What's This Help. When What's This Help is enabled, context-sensitive Help for the form is disabled.

To enable What's This Help for a form

  1. With the form selected, double-click the WhatsThisHelp property in the Properties window to set it to True.

  2. Set the following properties to add a What's This button to the title bar of the form:

Property Setting
BorderStyle 1 – Fixed Single or 2 – Sizable
MaxButton False
MinButton False
WhatsThisButton True
****Note****   A form can't have a What's This Help button if it has Minimize and Maximize buttons. As an alternative to the settings shown above, you can also set the BorderStyle property to 3 – Fixed Dialog, since a fixed dialog doesn't have Minimize and Maximize buttons.
  1. Select each control for which you want to provide What's This Help and assign a unique value to the WhatsThisHelpID property of the control.

    Keep track of the value that you enter so that you can use the same value for the context ID of the associated Help topic.

    Important   To implement What's This Help in HTML Help, all What's This Help topics must be contained in a Cshelp.txt file that is compiled into the .chm file. For more information, see the documentation for your HTML Help authoring tool.

    You can also enable What's This Help without using a What's This button by setting the WhatsThisHelp property of the form to True and invoking the WhatsThisMode method of a form or the ShowWhatsThis method of a control.