ToolBoxItem

ToolBoxItem Object

Visual Studio .NET 2003

Represents an item in the ToolBox.

DTE

   Windows

      Window

         ToolBox

            ToolBoxTabs

               ToolBoxTab

                  ToolBoxItems

                     ToolBoxItem

[Visual Basic .NET]
Public Interface ToolBoxItem
    Inherits IDispatch
[Visual Basic 6]
Class ToolBoxItem
[C++]
interface ToolBoxItem : IDispatch
[C#]
public interface ToolBoxItem : IDispatch
[JScript .NET]
public interface ToolBoxItem extends IDispatch

Remarks

A ToolBoxItem object can contain controls, text and HTML fragments, or other insertable objects.

Example

Sub ToolBoxItemExample()
   ' Define the variables and create an object reference to the IDE's  
   ' ToolBox object.
   Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindToolbox)
   Dim objToolbox As ToolBox = win.Object
   Dim colTbxTabs As ToolBoxTabs
   Dim objTbxItem As ToolBoxItem

   ' Create an object reference to the ToolBoxTabs object.
   colTbxTabs = objToolbox.ToolBoxTabs

   ' Now you can manipulate the ToolBox.
   ' List the total number of tabs in the ToolBox.
   MsgBox("Number of ToolBox tabs: " & colTbxTabs.Count)
   ' Add a tab to the ToolBox.
   colTbxTabs.Add("A New Toolbox Tab")
   ' List the total number of tabs in the ToolBox.
   MsgBox("Number of ToolBox tabs: " & colTbxTabs.Count)
   ' Add a couple of items to the new tab: one a text item, the other an 
   ' HTML item.
   objTbxItem = colTbxTabs.Item("A New Toolbox Tab").ToolBoxItems.Add("New Text Item", "Some text to add to the document.", vsToolBoxItemFormat.vsToolBoxItemFormatText)
   objTbxItem = colTbxTabs.Item("A New Toolbox Tab").ToolBoxItems.Add("New HTML Item", "This is some text to add to the HTML file.", vsToolBoxItemFormat.vsToolBoxItemFormatHTML)
End Sub

See Also

Properties, Events, and Methods| ToolBox Object | ToolBoxItems Collection | ToolBoxTab Object | ToolBoxTabs Collection

Show:
© 2016 Microsoft