Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

File.Exists Method

Class

System.IO.File

Syntax

Dim result As Boolean = File.Exists(path)

path (required; String)

The file path to test for existence

Description

The Exists method indicates whether a file exists (true) or not (False).

Usage at a Glance

  • path can be either an absolute path or a relative path from the current directory.

  • path can be either a path on the local system, the path of a mapped network drive, or a UNC path.

  • path cannot contain wildcard characters.

Version Differences

Visual Basic 2005 includes a My.Computer.FileSystem.FileExists method that provides similar functionality.

See Also

Directory.Exists Method

Категории