Share via


ToolBoxItems.SelectedItem Property

Definition

Gets the item currently selected in the tab of the ToolBox, if any exist.

public:
 property EnvDTE::ToolBoxItem ^ SelectedItem { EnvDTE::ToolBoxItem ^ get(); };

Property Value

A ToolBoxItem object.

Attributes

Examples

Sub SelectedItemExample(ByVal dte As DTE2)  

    ' Before running this example, select an item in the   
    ' ToolBox window.  

    Dim tab As ToolBoxTab = dte.ToolWindows.ToolBox.ActiveTab  
    Dim item As ToolBoxItem = tab.ToolBoxItems.SelectedItem  

    If IsNothing(tab) = False Then  
        MsgBox("The selected toolbox item is " & item.Name)  
    Else  
        MsgBox("No toolbox item is selected")  
    End If  

End Sub  

Remarks

If no items exist in the ToolBox tab or if no item is selected, then SelectedItem returns Nothing.

Applies to