Udostępnij za pośrednictwem


Help2.DisplayTopicFromKeyword(String) Method

Definition

Performs a lookup by using the K-keyword index.

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

Parameters

pszKeyword
String

K-keyword index of the Help topic to find and display.

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;  
    HelpDisplayFromKeywordExample(_applicationObject);  
}  

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

        // Display the Arrays topic.  
        help2.DisplayTopicFromKeyword("arrays");  
    }  

    catch (SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Remarks

If only one match is found then Document Explorer displays the topic.

Applies to