Nothing in the BCL but there's the native API PathRelativePathTo.
How do I use it from VB.NET?
Declare Auto Function PathRelativePathTo Lib "shlwapi.dll" (ByVal
pszPath As StringBuilder, ByVal pszFrom As String, ByVal dwAttrFrom As
Integer, ByVal pszTo As String, ByVal dwAttrTo As Integer) As Boolean
....
Const FILE_ATTRIBUTE_DIRECTORY As Integer = &H10
Dim relativePath As New StringBuilder(260)
PathRelativePathTo(relativePath, "C:\Windows\System32",
FILE_ATTRIBUTE_DIRECTORY, "C:\Program Files\Microsoft Visual Studio
..NET 2003", FILE_ATTRIBUTE_DIRECTORY)
Console.WriteLine(relativePath)
' Prints ..\..\Program Files\Microsoft Visual Studio .NET 2003
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ |
http://www.dotnetinterop.com
Please reply only to the newsgroup.