|
|
Title | Use a FileInfo object to resolve relative path names in Visual Basic .NET |
Description | This example shows how to use a FileInfo object to resolve relative path names in Visual Basic .NET. |
Keywords | relative path, resolve relative path, FileInfo, VB.NET |
Categories | VB.NET, Files and Directories |
|
|
The FileInfo object represents information about a file. The following code creates a new FileInfo object, using the relative path entered in the txtRelativePath text box in the constructor. It then displays the file's resolved name returned by the object's FullName property.
|
|
Dim file_info As New FileInfo(txtRelativePath.Text)
txtResolvedPath.Text = file_info.FullName
|
|
Note that the file and the directories in the path need not actually exist. For example, you could resolve the path "X:\apple\banana\..\fish\" even if you don't have an X drive.
|
|
|
|
|
|