This documentation is archived and is not being maintained.

SelectionContainer Object

Visual Studio .NET 2003

Represents the selection context with objects that model the selection below the project item level.




[Visual Basic .NET]
Public Interface SelectionContainer
    Inherits IDispatch
[Visual Basic 6]
Class SelectionContainer
interface SelectionContainer : IDispatch
public interface SelectionContainer : IDispatch
[JScript .NET]
public interface SelectionContainer extends IDispatch


The SelectionContainer object is a generic selection-tracking object. There is one global selection object for the environment: DTE.SelectedItems.SelectionContainer.

SelectedItems is a collection that represents individual ProjectItem objects, from which you can get the Project object. Because an item can offer a selection of an arbitrary object within its context, however, the SelectionContainer can represent any type of selected object.


Namespace: EnvDTE

File: dte.olb


Sub SelectionContainerExample()
   Dim SelContain As SelectionContainer
   Dim ContainerItem As SelectedItem

   ' Set references to the selection container and its selected item.
   SelContain = DTE.SelectedItems.SelectionContainer
   ContainerItem = DTE.SelectedItems.Item(1)

   ' Print the name of the container of the selected item.
End Sub

See Also

Properties, Methods, and Events | SelectedItem Object | SelectedItems Collection | SelectionContainer Property