Rediger

Del via


HelpProvider.SetHelpNavigator(Control, HelpNavigator) Method

Definition

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

public:
 virtual void SetHelpNavigator(System::Windows::Forms::Control ^ ctl, System::Windows::Forms::HelpNavigator navigator);
public virtual void SetHelpNavigator (System.Windows.Forms.Control ctl, System.Windows.Forms.HelpNavigator navigator);
abstract member SetHelpNavigator : System.Windows.Forms.Control * System.Windows.Forms.HelpNavigator -> unit
override this.SetHelpNavigator : System.Windows.Forms.Control * System.Windows.Forms.HelpNavigator -> unit
Public Overridable Sub SetHelpNavigator (ctl As Control, navigator As HelpNavigator)

Parameters

ctl
Control

A Control for which to set the Help keyword.

navigator
HelpNavigator

One of the HelpNavigator values.

Exceptions

The value of navigator is not one of the HelpNavigator values.

Examples

The following code example demonstrates the use of the SetHelpNavigator method.

To run this example, place it in a form containing a HelpProvider named HelpProvider1 and a TextBox named TextBox1. The example requires the existence of a Help file named input.chm in the C:\Windows directory.

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

private:
   void InitializeHelpProvider()
   {
      // Construct the HelpProvider Object.
      this->HelpProvider1 = gcnew 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 );
   }

//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);
}

'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

Applies to

See also