Click to Rate and Give Feedback

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Automation and Extensibility Reference
ProjectItem Interface

Represents an item in a project.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)
Visual Basic (Declaration)
<GuidAttribute("0B48100A-473E-433C-AB8F-66B9739AB620")> _
Public Interface ProjectItem
Visual Basic (Usage)
Dim instance As ProjectItem
C#
[GuidAttribute("0B48100A-473E-433C-AB8F-66B9739AB620")]
public interface ProjectItem
Visual C++
[GuidAttribute(L"0B48100A-473E-433C-AB8F-66B9739AB620")]
public interface class ProjectItem
JScript
public interface ProjectItem
Visual Basic
' Before running, create a new project or open an existing project.
Sub ListProj()
   Dim proj As Project = DTE.ActiveSolutionProjects(0)
   Dim win As Window = _
     DTE.Windows.Item(Constants.vsWindowKindCommandWindow)
   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
   Next
End Sub
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker