Export (0) Print
Expand All

HelpProvider.SetHelpNavigator Method

Specifies the Help command to use when retrieving Help from the Help file for the specified contol.

[Visual Basic]
Public Overridable Sub SetHelpNavigator( _
   ByVal ctl As Control, _
   ByVal navigator As HelpNavigator _
)
[C#]
public virtual void SetHelpNavigator(
 Control ctl,
 HelpNavigator navigator
);
[C++]
public: virtual void SetHelpNavigator(
 Control* ctl,
 HelpNavigator navigator
);
[JScript]
public function SetHelpNavigator(
   ctl : Control,
 navigator : HelpNavigator
);

Parameters

ctl
A Control for which to set the Help keyword.
navigator
One of the HelpNavigator values.

Exceptions

Exception Type Condition
InvalidEnumArgumentException The value of navigator is not one of the HelpNavigator values.

Example

[Visual Basic, C#] The following example demonstrates the SetHelpNavigator method. To run this example place it in a form containing a HelpProvidernamed HelpProvider1 and a TextBox named TextBox1. Call InitializeHelpProvider in the form's constructor or load method. The sample assumes the existence of a help file name input.chm in the c:\windows directory.

[Visual Basic] 

    'Declare the HelpProvider.
    Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider


    Private Sub InitializeHelpProvider()

        ' Construct the HelpProvider Object.
        Me.HelpProvider1 = New System.Windows.Forms.HelpProvider

        ' Set the HelpNamespace property to the Help file for 
        ' HelpProvider1.
        Me.HelpProvider1.HelpNamespace = "c:\windows\input.chm"

        ' Specify that the Help provider should open to the table
        ' of contents of the Help file.
        Me.HelpProvider1.SetHelpNavigator(TextBox1, _
            HelpNavigator.TableOfContents)

    End Sub

[C#] 

    //Declare the HelpProvider.
    internal System.Windows.Forms.HelpProvider HelpProvider1;


    private void InitializeHelpProvider()
    {
        // Construct the HelpProvider Object.
        this.HelpProvider1 = new System.Windows.Forms.HelpProvider();

        // Set the HelpNamespace property to the Help file for 
        // HelpProvider1.
        this.HelpProvider1.HelpNamespace = "c:\\windows\\input.chm";

        // Specify that the Help provider should open to the table
        // of contents of the Help file.
        this.HelpProvider1.SetHelpNavigator(TextBox1, 
            HelpNavigator.TableOfContents);
    }

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

HelpProvider Class | HelpProvider Members | System.Windows.Forms Namespace | GetHelpString | GetHelpKeyword | GetShowHelp | SetHelpString | SetHelpKeyword

Show:
© 2014 Microsoft