Peter
Fri May 09 15:42:09 CDT 2008
On Fri, 09 May 2008 12:45:02 -0700, jehugaleahsa@gmail.com =
<jehugaleahsa@gmail.com> wrote:
> Hello:
>
> Correct me if I'm wrong, but it appears that saving a file with the
> SaveFileDialog changes the Environment.CurrentDirectory property.
>
> How can I prevent this?
This has been answered before:
http://groups.google.com/groups/search?q=3Dgroup%3Amicrosoft.public.dotn=
et.languages.csharp+file+dialog+current+directory&qt_s=3DSearch
In some of the top threads related to that search, you'll find mention =
that the FileDialog.RestoreDirectory property controls this behavior.
Of course, I suppose you could have also just looked at the documentatio=
n =
for the SaveFileDialog. IMHO, the first thing anyone should do when the=
y =
are trying to find the answer to a question related to the use of a =
particular framework class is read through the entire list of public =
members of the class in question. Often what you're looking for will be=
=
found there. :)
If you look through the previous threads that Google shows you, you will=
=
also see good advice that generally you should not be relying on the =
current directory anyway. Sometimes when dealing with legacy code it's =
=
safer to just not change the current directory. But it's usually better=
=
to just use full path names when referencing the file system. Then you'=
re =
not dependent on side-effects of other code and/or use actions.
Pete