Export (0) Print
Expand All

ToolBoxTab2 Interface 

Represents a tab in the Toolbox, along with any objects the tab contains.

Namespace: EnvDTE80
Assembly: EnvDTE80 (in envdte80.dll)

[GuidAttribute("A64715CB-85D7-41C3-8E71-2302D4EEBC34")] 
public interface ToolBoxTab2 : ToolBoxTab
/** @attribute GuidAttribute("A64715CB-85D7-41C3-8E71-2302D4EEBC34") */ 
public interface ToolBoxTab2 extends ToolBoxTab
GuidAttribute("A64715CB-85D7-41C3-8E71-2302D4EEBC34") 
public interface ToolBoxTab2 extends ToolBoxTab

This example selects and activates the first ToolBoxTab2 item and displays its name in a message box. For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ToolBoxTabExample(_applicationObject);
}
public void ToolBoxTabExample(DTE2 dte)
{
    ToolBox tlBox;
    ToolBoxTabs tbxTabs;
    ToolBoxTab2 tbxTab;
    ToolBoxItem tbxItem;
    try
    {
        // Create an object reference to the IDE's ToolBox object and
        // its tabs.
        tlBox = (ToolBox)_applicationObject.Windows.Item
(Constants.vsWindowKindToolbox).Object;
        tbxTabs = tlBox.ToolBoxTabs;
        // Select the first Toolbox Tab.
        tbxTab = (ToolBoxTab2)tbxTabs.Item(1);
        MessageBox.Show("The name of the first Toolbox tab is: " 
+ tbxTab.Name);
        tbxTab.Activate();
        tbxItem = tbxTab.ToolBoxItems.Item(1);
        MessageBox.Show("Toolbox item name: " + tbxItem.Name);
    }
    catch (Exception ex)
    {
        MessageBox.Show("ERROR: " + ex.Message);
    }
}
Show:
© 2014 Microsoft