Home > Basic Functions > Context-sensitive Help > Windows Applications > Windows Field Help Button

Windows Field Help Button

You can add multiple help buttons, icons or hyperlinks to a form within your Windows application that open specific help pages. Follow the steps below to add help buttons to your Visual Studio 2003/2005 Windows application.

1. Open a form (such as a login form) within your Visual Studio Windows application.


2. Double click the 'Button' control twice to add two buttons to the form. Change the 'text' property to 'Help' for both'. Position the buttons beside the fields that you want to provide help for.


3. Double click each button to open the code window.


4. Add the following code to the "Sub Button1_Click" event:

Open a Dynamic Help Page
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Help.ShowHelp(Button1, http://www.domain.com/help/default.aspx?pageid=username)
End Sub

Open a Dynamic Help Page (within help system)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Help.ShowHelp(Button1, http://www.domain.com/help/default.aspx?pageid=username)
End Sub

Open a Static Help Page

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Help.ShowHelp(Button1, "help\username.htm")
End Sub
* the url above assumes that the help system is in a sub folder named 'help'

Open a Static Help Page (within help system)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Help.ShowHelp(Button1, "help\username.htm")
End Sub
* Note: a page parameter cannot be passed when a static help system is opened from Visual Studio,  so in order to display a specific page within the help system, the static help system must be created without frames. See Publishing a Static Help System for more information.



ShowHelp Syntax:    Help.ShowHelp(Parent, URL)
Parent - Name of the button control
URL - The url of the help system



5. Press F5 to run the application. Click the 'Help' button.






See also
URL Parameters
Windows Application Help Button
Windows Form Help Button
Windows F1 Application Help
Windows F1 Form Help
Windows F1 Field Help