473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why does CurDir() change persist?

Hi All,

I change the current directory in a proc, using CurDir(). The change
persists across executions. I would like the CurDir() return value to be the
same at the start of each execution. Any suggestions will be appreciated.
The code below illustrates the problem. Thanks.

Dim currentDir As String
MsgBox CurDir()

currentDir = CurDir() + "\foo"

MsgBox currentDir

ChDir (currentDir )


Aug 13 '05 #1
1 6825
CurDir does not change the working folder, only ChDrive/ChDir does. Not
sure what your example is supposed to prove, other than the second
messagebox has the same value as the first one but with \foo appended.

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
----------------------------------------------------------------------------

"Lance" <Lb******@yahoo.com> wrote in message
news:Cw*******************@newsb.telia.net...
: Hi All,
:
: I change the current directory in a proc, using CurDir(). The change
: persists across executions. I would like the CurDir() return value to be
the
: same at the start of each execution. Any suggestions will be appreciated.
: The code below illustrates the problem. Thanks.
:
: Dim currentDir As String
: MsgBox CurDir()
:
: currentDir = CurDir() + "\foo"
:
: MsgBox currentDir
:
: ChDir (currentDir )
:
:
:
:

Aug 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Greg Kuperberg | last post by:
I plan to use pydoc for my Python project. After looking through the standard documentation, I am not sure how pydoc interprets its input. In its basic operation it evidently looks at the first...
2
by: Sami | last post by:
I keep getting the famous 'Too Many Connection' Error, and don't know how to change my variables, so they persist even if i have to restart mysql service. Platform: Windows 2003 Server My...
6
by: Ian | last post by:
Can someone tell me what CurDir returns, I am trying to find the path to the Drive letter where Windows is installed on a PC, using code like: Function DriveLetter() Dim curdrv As String ...
6
by: Bob | last post by:
Having trouble getting started. I created an instance of MSDE called VSDOTNET on a computer with the name of sysdev. Using MS SQL Web Adminstrator I created a database called temp with a...
1
by: RAJ | last post by:
Hi, I am acccessing my crystal reports bundled version developed in VB.NET 2002. I stored my report in local C drive and set the report source as follows: rptPositiveMatch.ReportSource =...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
2
by: Protoman | last post by:
What does this do? int& fn(int& arg){arg++;return arg;} //later int y; fn(y)=5; Why can you do it? What do you use it for? Thanks!!!
10
by: dingjie | last post by:
<configuration> <appSettings/> <connectionStrings> <add name="pedbConnectionString" connectionString="Data Source=localhost;Initial Catalog=acsdb;Persist Security Info=True;User...
0
by: Renatebhp | last post by:
While using CurDir to get the current path where my open workbook is located, I get a result that's short of the current folder.e.g. the path to the file is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.