Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Can I display the working directory?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-08-2004, 04:42 PM
HappyJoni's Avatar
HappyJoni HappyJoni is offline
Centurion
 
Join Date: Jun 2003
Location: New Jersey
Posts: 150
Default Can I display the working directory?


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
Reply With Quote
  #2  
Old 03-08-2004, 06:04 PM
sgt_pinky's Avatar
sgt_pinky sgt_pinky is offline
Contributor
 
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 633
Default

Call the function "CurDir"

eg:

Code:
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.
Reply With Quote
  #3  
Old 03-08-2004, 09:03 PM
HappyJoni's Avatar
HappyJoni HappyJoni is offline
Centurion
 
Join Date: Jun 2003
Location: New Jersey
Posts: 150
Default Thanks so much!

You saved me so much time. I really appreciate your help :-)

Joni
Reply With Quote
  #4  
Old 03-08-2004, 11:20 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

Quote:
Originally Posted by sgt_pinky

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.
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!
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell command from a directory... Kasdoffe General 3 01-21-2004 11:46 AM
add & display Appointment form and Schedule form WRX_Programmer General 16 11-11-2003 02:34 AM
Grids Display Data From A DB supra80 Database and Reporting 0 11-10-2003 03:38 PM
FTP not setting current directory kkonkle API 2 09-29-2003 10:30 AM
Please help me create a directory chrisivan General 6 02-13-2003 09:17 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->