ho i'm converting a my project from vb6 to vb.net Is there an analog method in vb.net of shortpath?
Dim DestinationFile As Scripting.File
...
DestinationFile.ShortPath
Thanks
ho i'm converting a my project from vb6 to vb.net Is there an analog method in vb.net of shortpath?
Dim DestinationFile As Scripting.File
...
DestinationFile.ShortPath
Thanks
No, modern languages are not built to use short paths, but you can use the GetShortPathName method from the kernel:
Call using:
Your VB6 is using the Windows
FileSystemObject
via COM.It seems there's no functionality in .Net to get a short filename. Rather than using P/Invoke to call the Windows API, as in the other answers, it's simpler to use the same FileSystemObject through COM in your VB.Net. Just add a COM reference to "Microsoft Scripting Runtime". Then the VB6 code will probably work almost unchanged in VB.Net.
What I could find so far is that there is no managed code for this, but you can do this:
Method declaration was found at PInvoke.net