Udostępnij za pośrednictwem


Help2.SyncIndex(String, Int32) Method

Definition

Looks up the topic specified by the K-keyword, but it does not display the topic in Document Explorer, unless specified.

public:
 void SyncIndex(System::String ^ bstrKeyword, int fShow);
public:
 void SyncIndex(Platform::String ^ bstrKeyword, int fShow);
void SyncIndex(std::wstring const & bstrKeyword, int fShow);
[System.Runtime.InteropServices.DispId(19)]
public void SyncIndex (string bstrKeyword, int fShow);
[<System.Runtime.InteropServices.DispId(19)>]
abstract member SyncIndex : string * int -> unit
Public Sub SyncIndex (bstrKeyword As String, fShow As Integer)

Parameters

bstrKeyword
String

A string containing the K-keyword.

fShow
Int32

Set to force the Index window to open.

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

public void HelpSyncContentsexample(DTE2 dte)  
{  
    // This add-in synchronizes the Help index to   
    // the supplied index.  
    try  
    {  
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =  
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");  

        // Synchronize index.  
        help2.SyncIndex("FLT_RADIX constant", 1);  
    }  

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

Applies to