_Solution.FindProjectItem Method

Locates an item in a project.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Function FindProjectItem ( _
    FileName As String _
) As ProjectItem
ProjectItem FindProjectItem(
    string FileName
)
ProjectItem^ FindProjectItem(
    String^ FileName
)
abstract FindProjectItem : 
        FileName:string -> ProjectItem 
function FindProjectItem(
    FileName : String
) : ProjectItem

Parameters

  • FileName
    Type: System.String
    Required. The name of the project item.

Return Value

Type: EnvDTE.ProjectItem
A ProjectItem object.

Remarks

FindProjectItem performs an ItemOperations.OpenFile type search for the given file name. The first project found to have the item returns its ProjectItem object for the name. If the file is not found in the solution, nulla null reference (Nothing in Visual Basic) is returned.

Examples

Sub CreateExample()
   ' Open a solution before running this example.
   Dim soln As Solution

   ' Create a reference to the solution.
   soln = DTE.Solution

   ' Find the specified project.
   soln.FindProjectItem("c:\temp\someproj.vbproj")
End Sub

.NET Framework Security

See Also

Reference

_Solution Interface

EnvDTE Namespace