This documentation is archived and is not being maintained.

FileNames Property (ProjectItem Object)

Visual Studio .NET 2003

Returns the full path and names of the files associated with a project item.

[Visual Basic .NET]
Public ReadOnly Property FileNames( _
   ByVal index As Integer _
) As String
[Visual Basic 6]
Property Get FileNames( _
   ByVal index As Integer _
) As String
HRESULT __stdcall get_FileNames(
   short index,
   /* [out, retval] */ BSTR* retVal
string FileNames(
   short index
) {get;}
[JScript .NET]
public function get FileNames(
   index : short
) : String


Required. The index of file names from 1 to FileCount for the project item.


Most project items have only one file associated with them, but some languages, such as Visual Basic, can have two files per item: a form file and a .bas file. When the project item's ProjectItems property has a value, and the ProjectItem object represents a directory on disk, then the FileNames property contains of the full path of the directory.


Sub FileNamesExample()
   Dim proj As Project
   Dim projitems As ProjectItems

   ' Reference the current solution and its projects and project items.
   proj = DTE.ActiveSolutionProjects(0)
   projitems = proj.ProjectItems

   ' List the filename associated with the first project item.
End Sub

See Also

FileCount Property (General Extensibility)

Applies To: ProjectItem Object