RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Incorporating Help into Your Windows Applications : Page 2

How much effort do you put into ensuring that your users get all the help they need? You probably strive to design a user-friendly user interface, but do you provide any avenue for your users to get help when they are stuck?

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) _
       Handles MyBase.Load
        With Me
            .MinimizeBox = False
            .MaximizeBox = False
            .HelpButton = True
        End With
    End Sub

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:

        HelpProvider1.SetHelpString( _
           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:

        HelpProvider1.SetShowHelp(TextBox1, False)

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date