CombinePath Method


CombinePath Method

Location

My.Computer.FileSystem.CombinePath

Syntax

     Dim result As String = _            My.Computer.FileSystem.CombinePath(baseDirectory, relativePath) 


baseDirectory (required; String)

The first path to be combined; an absolute path, either in UNC or drive-letter format


relativePath (required; String)

The second path to be combined; a relative path

Description

The CombinePath method combines an absolute path component with a relative path component and returns a properly concatenated and formatted version. The concatenation properly inserts backslashes in the right places.

Usage at a Glance

An exception is thrown if one or both of the paths are malformed. Neither the two input paths nor the final output path need exist, but they all must be in a valid format.

Example

The following example combines a root directory path and a relative path component into a single formatted path.

     Dim finalPath As String         finalPath = My.Computer.FileSystem.CombinePath _            (My.Computer.FileSystem.SpecialDirectories.MyDocuments, _        "Business\Expenses.txt") 

Related Framework Entries

  • Microsoft.VisualBasic.MyServices.FileSystemProxy.CombinePath Method

  • Microsoft.VisualBasic.FileIO.FileSystem.CombinePath Method

  • System.IO.Path.Combine Method

See Also

FileSystem Object, GetName Method, GetParentPath Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net