ToolBoxItem2.Data Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an object containing the IDataObject
of the ToolBoxItem on the tool box.
public:
property System::Object ^ Data { System::Object ^ get(); };
public:
property Platform::Object ^ Data { Platform::Object ^ get(); };
[System.Runtime.InteropServices.DispId(10)]
public object Data { [System.Runtime.InteropServices.DispId(10)] get; }
[<System.Runtime.InteropServices.DispId(10)>]
[<get: System.Runtime.InteropServices.DispId(10)>]
member this.Data : obj
Public ReadOnly Property Data As Object
Property Value
An object containing the data a tool box item contains.
- Attributes
Examples
This example selects the second ToolBoxItem2 item and displays its name in a message box. The example also displays assembly information obtained through the ToolBoxItem2.Data
object.
Imports EnvDTE
Imports EnvDTE80
Sub ToolBoxItemDataExample(ByVal dte As DTE2)
Dim tlBox As ToolBox
Dim tbxTabs As ToolBoxTabs
Dim tbxTab As ToolBoxTab2
Dim tbxItem As ToolBoxItem2
' Before running this example, open a Windows Application project.
Try
' Create an object reference to the IDE's ToolBox object and
' its tabs.
tlBox = CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindToolbox).Object, ToolBox)
tbxTabs = tlBox.ToolBoxTabs
' Select the second ToolBox tab.
tbxTab = CType(tbxTabs.Item(2), ToolBoxTab2)
tbxTab.Activate()
MsgBox("Toolbox tab name: " & tbxTab.Name)
tbxItem = CType(tbxTab.ToolBoxItems.Item(2), ToolBoxItem2)
MsgBox("Toolbox item name: " & tbxItem.Name)
MsgBox(tbxItem.Name & "'s Assembly type, obtained through _
the Data object:" & vbCr _
& tbxItem.Data.GetType.Assembly.ToString())
Catch ex As System.Exception
MsgBox("ERROR: " & ex.Message)
End Try
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void ToolBoxItemDataExample(DTE2 dte)
{
ToolBox tlBox;
ToolBoxTabs tbxTabs;
ToolBoxTab2 tbxTab;
ToolBoxItem2 tbxItem;
// Before running this example, open a Windows Application project
// and select Toolbox from the View menu.
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 second Toolbox tab.
tbxTab = (ToolBoxTab2)tbxTabs.Item(2);
tbxTab.Activate();
MessageBox.Show("Toolbox tab name: " + tbxTab.Name);
tbxItem = (ToolBoxItem2)tbxTab.ToolBoxItems.Item(2);
MessageBox.Show("Toolbox item name: " + tbxItem.Name);
MessageBox.Show(tbxItem.Name + "'s Assembly type,
obtained through the Data object:" + "\n"
+ tbxItem.Data.GetType().Assembly.ToString());
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}
}