Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ToolBoxTab.Activate Method

Moves the focus to the current item.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

void Activate()

When Activate is invoked, it is as if the user clicked the item, but no click events occurred.

public void ActivateExample(DTE2 dte)
{
    // Add a new tab to the ToolBox.
    ToolBox box = dte.ToolWindows.ToolBox;
    ToolBoxTab tab = 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();
}

Show:
© 2015 Microsoft