Help2.Filter Property
Gets or sets the collection filter.
Namespace: Microsoft.VisualStudio.VSHelp80
Assembly: Microsoft.VisualStudio.VSHelp80 (in Microsoft.VisualStudio.VSHelp80.dll)
Syntax
'Déclaration
Property Filter As String
string Filter { get; set; }
property String^ Filter {
String^ get ();
void set (String^ value);
}
abstract Filter : string with get, set
function get Filter () : String
function set Filter (value : String)
Property Value
Type: System.String
Returns a string containing the filter name.
Implements
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);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.