Udostępnij za pośrednictwem


Help2.Filter Property

Definition

Gets or sets the collection filter.

public:
 property System::String ^ Filter { System::String ^ get(); void set(System::String ^ value); };
public:
 property Platform::String ^ Filter { Platform::String ^ get(); void set(Platform::String ^ value); };
[System.Runtime.InteropServices.DispId(22)]
public string Filter { [System.Runtime.InteropServices.DispId(22)] get; [System.Runtime.InteropServices.DispId(22)] set; }
[<System.Runtime.InteropServices.DispId(22)>]
[<get: System.Runtime.InteropServices.DispId(22)>]
[<set: System.Runtime.InteropServices.DispId(22)>]
member this.Filter : string with get, set
Public Property Filter As String

Property Value

Returns a string containing the filter name.

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.

Note

Be sure to set a filter on the Visual Studio Help collection before you run this example. Otherwise the method will return a null exception.

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

public void HelpFilterExample(DTE2 dte)  
{  
    // This add-in displays a message box with the filter applied to   
    // the active Help collection.  
    // inIt then changes the filter  
    // and displays the Contents window of Document   
    // Explorer with the new filter applied.  
    try  
    {  
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =  
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");  

        // Display the name of the filter.  
        MessageBox.Show("The Help filter name is: "  
help2.Filter.ToString());  
        // Set the filter to Visual C#.  
        help2.Filter = "Visual C#";  
        // Set the focus to the Contents window and  
        // open Document Explorer.  
        help2.Contents();  
    }  
    catch (SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Applies to