How to: Determine the Absolute Path of a File in Visual Basic
The GetFileInfo method returns a FileInfo object that can be used to determine information about a file, including its location, which is contained in the FullName property.
If a file does not exist, GetFileInfo does not throw an exception, but one is thrown the first time a property on the System.IO.FileInfo object is accessed.
The following conditions may cause an exception:
-
The path name is malformed. For example, it contains invalid characters or is only white space (ArgumentException).
-
The file does not exist or is Nothing (ArgumentNullException).
-
The path contains a colon in the middle of the string (NotSupportedException).
-
The path is too long (PathTooLongException).
-
The user lacks necessary permissions (SecurityException).
-
The user lacks ACL (access control list) access to the file (UnauthorizedAccessException).