Help2.DisplayTopicFromF1Keyword(String) Method

Definition

Displays Help for F1 and from dialog boxes.

public:
 void DisplayTopicFromF1Keyword(System::String ^ pszKeyword);
public:
 void DisplayTopicFromF1Keyword(Platform::String ^ pszKeyword);
void DisplayTopicFromF1Keyword(std::wstring const & pszKeyword);
[System.Runtime.InteropServices.DispId(10)]
public void DisplayTopicFromF1Keyword (string pszKeyword);
[<System.Runtime.InteropServices.DispId(10)>]
abstract member DisplayTopicFromF1Keyword : string -> unit
Public Sub DisplayTopicFromF1Keyword (pszKeyword As String)

Parameters

pszKeyword
String

String containing the F1 keyword to display the associated topicc..

Implements

Attributes

Examples

Create a Visual Studio add-in by using Visual C# as described in How to: Create an Add-In. Add references to Microsoft.VisualStudio.VSHelp, Microsoft.VisualStudio.VSHelp80, and System.Windows.Forms. Replace the code in the OnConnection method in the Connect.cs file with the following code. Run the code example as described in How to: Compile and Run the Automation Object Model Code Examples.

using System;  
using Extensibility;  
using EnvDTE;  
using EnvDTE80;  
using Microsoft.VisualStudio.VSHelp;  
using Microsoft.VisualStudio.VSHelp80;  
using System.Windows.Forms;  

public void OnConnection(object application,  
ext_ConnectMode connectMode, object addInInst, ref Array custom)  
{  
    _applicationObject = (DTE2)application;  
    _addInInstance = (AddIn)addInInst;  
    HelpDisplayFromF1Example(_applicationObject);  
}  

public void HelpDisplayFromF1Example(DTE2 dte)  
    {  
    // This opens Document Explorer and   
    // displays the topic specified  
    // by the F1 keyword.  
    try  
    {  
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =  
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");  

        // Display the Owner Attribute topic.  
        help2.Contents();  
        help2.DisplayTopicFromF1Keyword("Owner");  
    }  
    catch (SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Applies to