Displaying the "?" Button
Another way to offer your users help is to implement the "?" button. This help button can usually be found on the top-right corner of a window. When users need help with your application, they can click on the "?" button and then click on controls on your form to display the help message for each control (which you will implement).
To display the "?" button on a form, you need to set the form's HelpButton property to True, like this:
|Figure 3. Display Help Messages: Drop the HelpProvider control onto your form to display help messages.|
Private Sub Form2_Load( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
.MinimizeBox = False
.MaximizeBox = False
.HelpButton = True
Note that you need to set the MinimizeBox and MaximizeBox properties to False. If you don't, the "?" button will not be shown.
To associate the "?" button with help, use the HelpProvider control (also located in the Toolbox). The HelpProvider control extends the controls on your form with help capabilities.
Once you have dropped a HelpProvider control onto your form, you can set the "HelpString on HelpProvider1" property for the TextBox control with a string (as shown in Figure 3). This will associate a help message for the TextBox control.
When you run the application, you will see that the "?" button is displayed (see Figure 4). Click on the "?" button and then click on the TextBox control. You will notice that a help message is displayed.
|Figure 4. Display the "?" Button: This is displayed when you run the application.|
Programmatically, you can set the help string for a control using the HelpProvider control through the SetHelpString() method:
TextBox1, "This is a textbox for...")
To disassociate the help string from a control, use the SetShowHelp()
method and pass in False
for the second parameter: