GetParentPath Method


GetParentPath Method

Location

My.Computer.FileSystem.GetParentPath

Syntax

     Dim result As String = My.Computer.FileSystem.GetParentPath(path) 


path (required; String)

The path to be examined; an absolute or relative path

Description

The GetParentPath method examines a valid path and returns the parent portion. The path supplied to the method does not have to exist, but it must be in a valid format. Whether you supply the full path to a file or a directory, GetParentPath simply removes the final portion.

You can supply a relative path, but if you supply only a single path component (such as ".."), an empty string will be returned.

Usage at a Glance

  • The source path supplied does not need to exist in the file system.

  • An exception occurs if the source path is in an invalid format, or if the path is a "root" path that has no further parent.

Example

     workFolder = My.Computer.FileSystem.GetParentPath(workFile) 

Related Framework Entries

  • Microsoft.VisualBasic.MyServices.FileSystemProxy.GetParentPath Method

  • Microsoft.VisualBasic.FileIO.FileSystem.GetParentPath Method

  • System.IO.Directory.GetParent Method

  • System.IO.Path.GetDirectoryName Method

See Also

CombinePath Method, FileSystem Object, GetName 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