This documentation is archived and is not being maintained.

ProjectItem Object

Visual Studio .NET 2003

Represents an item in a project.






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


Namespace: EnvDTE

File: dte.tlb


' Before running, create a new project or open an existing project.
Sub ListProj()
   Dim proj As Project = DTE.ActiveSolutionProjects(0)
   Dim win As Window = _
   ListProjAux(proj.ProjectItems(), 0)
End Sub

Sub ListProjAux(ByVal projitems As ProjectItems, ByVal Level As Integer)
   Dim projitem As ProjectItem
   For Each projitem In projitems
      MsgBox("Project item: " & projitem.Name, Level)
      ' Recurse if the project item has sub-items...
      Dim projitems2 As ProjectItems
      projitems2 = projitem.ProjectItems
      Dim notsubcoll As Boolean = projitems2 Is Nothing
      If Not notsubcoll Then
         ListProjAux(projitems2, Level + 1)
      End If
End Sub

See Also

Project Object | Projects Collection | ProjectItems Collection

Properties, Methods, and Events