Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ToolBoxTab2.Delete Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Removes the ToolBoxTab from a collection.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)
void Delete()

This example adds a new item to a Toolbox tab, activates it, and then deletes it, if the user chooses to do so. 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.

public void DeleteExample(DTE2 dte)
{
    // Add a new tab to the Toolbox.
    ToolBox box = dte.ToolWindows.ToolBox;
    ToolBoxTab2 tab = (ToolBoxTab2)box.ToolBoxTabs.Add
("Sample ToolBoxTab");
    // Add two ToolBoxItem objects to the new Toolbox tab.
    ToolBoxItem item = tab.ToolBoxItems.Add("Text Item", 
        "Hello, text item!", 
        vsToolBoxItemFormat.vsToolBoxItemFormatText);
    tab.ToolBoxItems.Add("HTML Item", "Hello, HTML item!", 
        vsToolBoxItemFormat.vsToolBoxItemFormatHTML);
    // Select the "Text Item" ToolBox item.
    box.Parent.AutoHides = false;
    box.Parent.Activate();
    tab.Activate();
    item.Select();
    if (MessageBox.Show("Delete the selected Toolbox item?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
        item.Delete();
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.