Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

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.

To determine the absolute path of a file

  • Use the GetFileInfo method to return a FileInfo object for the file you wish to examine. The FullName property contains the absolute path. The following example determines the absolute path of Test.txt and displays it in a message box.

    
    Dim getInfo As System.IO.FileInfo
    getInfo = My.Computer.FileSystem.GetFileInfo("C:\TestFolder1\test.txt")
    MsgBox(getInfo.FullName)
    
    
    

The following conditions may cause an exception:

Community Additions

ADD
Show:
© 2015 Microsoft