_Solution.FindProjectItem(String) Method

Definition

Locates an item in a project.

public:
 EnvDTE::ProjectItem ^ FindProjectItem(System::String ^ FileName);
public:
 EnvDTE::ProjectItem ^ FindProjectItem(Platform::String ^ FileName);
EnvDTE::ProjectItem FindProjectItem(std::wstring const & FileName);
[System.Runtime.InteropServices.DispId(42)]
public EnvDTE.ProjectItem FindProjectItem (string FileName);
[<System.Runtime.InteropServices.DispId(42)>]
abstract member FindProjectItem : string -> EnvDTE.ProjectItem
Public Function FindProjectItem (FileName As String) As ProjectItem

Parameters

FileName
String

Required. The name of the project item.

Returns

A ProjectItem object.

Attributes

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  

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, null is returned.

Applies to