Help2.Contents Method

Definition

Selects the Contents navigation window and opens it if it is closed.

public:
 void Contents();
public:
 void Contents();
void Contents();
[System.Runtime.InteropServices.DispId(1)]
public void Contents ();
[<System.Runtime.InteropServices.DispId(1)>]
abstract member Contents : unit -> unit
Public Sub Contents ()

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

public void HelpContentsExample(DTE2 dte)  
{  
    // This opens Document Explorer and sets  
    // focus on the Contents window.  
    try  
    {  
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =  
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");  

                // Open Document Explorer and set focus on Contents window.  
                help2.Contents();  

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

Applies to