Can I display the working directory?

HappyJoni
03-08-2004, 04:42 PM
I'm writing a program that changes the working directory, depending on who the user is. I use the ChDir command to change directories. I want to make sure that it's actually changing directories. Is there a way to do this?


Private Sub cmbWho_Click()

Dim testdir As String

Select Case cmbWho.ListIndex
Case 0
ChDir ("M:\SCBMAIN\JANEZ\PRHOME")
Case 1
ChDir ("M:\SCBMAIN\KBARRY\PRHOME")
Case 2
ChDir ("M:\SCBMAIN\JBROWER\PRHOME")
Case 3
ChDir ("M:\SCBMAIN\JFELDSTEIN\PRHOME")
Case 4
ChDir ("M:\SCBMAIN\MHENRY\PRHOME")
Case 5
ChDir ("M:\SCBMAIN\PADDY\PRHOME")
End Select

End Sub

Any help/suggestions are greatly appreciated :)
Joni

sgt_pinky
03-08-2004, 06:04 PM
Call the function "CurDir"

eg:


chdir("C:\")
if strcnv(CurDir,vbUpperCase)="C:\" then msgbox "Directory changed successfully"


Note, its good practise to convert directories to either uppercase or lowercase, because otherwise you will compare the directories, and it will think they are different, even though they arent. :D

HappyJoni
03-08-2004, 09:03 PM
You saved me so much time. I really appreciate your help :-)

Joni

webbone
03-08-2004, 11:20 PM
Note, its good practise to convert directories to either uppercase or lowercase, because otherwise you will compare the directories, and it will think they are different, even though they arent. :D

This is ESPECIALLY important if you have to work in Win9x! Although you might see upper and/or lower case letters in Explorer, all the directory and file functions return lower-case only - I spent a week working on a problem like this because I forgot this icky little fact!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum