FileSystem.FileExists Method
Returns True if the specified file exists.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Parameters
- file
- Type: System.String
Name and path of the file.
Return Value
Type: System.BooleanReturns True if the file exists; otherwise this method returns False.
| Exception | Condition |
|---|---|
| ArgumentException |
The name of the file ends with a backslash (\). |
If the application does not have sufficient permissions to read the specified file, the FileExists method returns False, regardless of the existence of the path; the method does not throw an exception.
The following table lists an example of a task involving the My.Computer.FileSystem.FileExists method.
|
To |
See |
|
Determine if a file exists |
-
FileIOPermission
Controls the ability to access files and folders. Associated enumeration: Unrestricted.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.