malko
09-07-2000, 05:52 AM
i want to change my directory when launching my application.
The chdir doesn't seems to work.
i want to set the directory to : d:data
and it always stay somewhere on the C drive.
Thats the solution ???
Derek Stone
09-07-2000, 06:05 AM
ChDir sometimes doesn't work until you create the .exe.
It is unreliable and I never would use it.
Try going about the code a different way and avoid the use of it.
If you need help with the coding write back.
-cl
malko
09-07-2000, 06:11 AM
what the other way to change the working directory if the chdir command doesnt work ???
the documentation says chdir is for changing the working directory.
Is this a bug ?
if you have an other solution i am interested .
thanks.
Valkyrie
09-07-2000, 09:43 AM
chdir works fine...can you post your code around the use and what results you get. Perhaps it is in the way you are using (order of statements) rather that the command itself.
Cheers.
Quote of the moment....
"My job is so top secret even I don't know what I'm doing!"
The problem you are gettig may be a simple one:-
I presume you are running your app on your C:, so when you invoke the 'CHDIR "D:DATA""' command it is infact changing your D:drive's default directory, but your default drive is still C:. If you invoke the 'CHDIR "D:DATA""' command followed by 'CHDRIVE "D"', your working directory within your program should now be 'D:DATA'.
malko
09-07-2000, 11:46 AM
my code is
Private Sub Form_load()
ChDir ("d:data")
ChDrive ("D")
End Sub
after that in my form i have a dirlistbox
and when i launch my .exe i am still in c:windowsureau where is located my .exe.
if i put my .Exe on the D drive in my dirlistbox i am in d:
this making me crazy !!!!
Grimfort
09-07-2000, 11:56 AM
The DIRListBox that you are using has its own version of the path. It does not bother looking at the current path, so to get around this on your form load event add the code
Dir1.Path = "d:??"
And it will set the opening path as the one that you specified.
Grimfort