T
Tygur
Guest
Consider this VB6 code:
Assuming that the TestDir string is a full path to a directory that exists, that directory should be shown in the messagebox. If you test it out, it will perform as expected.
Now consider this VB.NET code:
This code should do the same exact thing as the VB6 code I just showed you. In fact, it was the Visual Studio .NET IDE that converted the code for me.
If you run that VB.NET code, the directory shown in the message box doesn't seem to be the same as the one in TestDir if the directory in TestDir is on any drive other than drive C (or whichever drive that last ChDrive line changes to). Did I just find a bug, or did I miss something?
NOTE: the culprit is this line (taken from the VB.NET code):
ChDrive("c:")
Apparently, it's changing the current path on the drive it's changing from in the process of changing the current drive.
Code:
Dim TestDir As String
TestDir = "d:\testdir"
ChDrive Left(TestDir, 1)
ChDir TestDir
ChDrive "c:"
MsgBox CurDir(Left(TestDir, 1))
Assuming that the TestDir string is a full path to a directory that exists, that directory should be shown in the messagebox. If you test it out, it will perform as expected.
Now consider this VB.NET code:
Code:
Dim TestDir As String
TestDir = "d:\testdir"
ChDrive(Left(TestDir, 1))
ChDir(TestDir)
ChDrive("c:")
MsgBox(CurDir(Left(TestDir, 1)))
This code should do the same exact thing as the VB6 code I just showed you. In fact, it was the Visual Studio .NET IDE that converted the code for me.
If you run that VB.NET code, the directory shown in the message box doesn't seem to be the same as the one in TestDir if the directory in TestDir is on any drive other than drive C (or whichever drive that last ChDrive line changes to). Did I just find a bug, or did I miss something?
NOTE: the culprit is this line (taken from the VB.NET code):
ChDrive("c:")
Apparently, it's changing the current path on the drive it's changing from in the process of changing the current drive.