473,491 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Saving / Resetting current directory

I have a project that includes images as part of the project. I have a grid
(Infragistics) with a button that the user clicks and it brings up a file
open dialog that is used to browse to a file so the path can be saved in the
grid. After the dialog is closed the program cannot find any of the images
that are part of the project. I believe that using the open file dialog is
changing the working directory and causing the error. Is there a way to
save the working directory, do the open file dialog and then reset the
working directory to its original state?
Dec 18 '07 #1
2 2410
To get the current path where the program is being run from, use
the static CurrentDirectory property on the Environment class. You can also
save the path into a static string field after the user saves the image. This
can then be used later when the OpenFileDialog is invoked again.

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Tim Kelley" wrote:
I have a project that includes images as part of the project. I have a grid
(Infragistics) with a button that the user clicks and it brings up a file
open dialog that is used to browse to a file so the path can be saved in the
grid. After the dialog is closed the program cannot find any of the images
that are part of the project. I believe that using the open file dialog is
changing the working directory and causing the error. Is there a way to
save the working directory, do the open file dialog and then reset the
working directory to its original state?
Dec 18 '07 #2
On Tue, 18 Dec 2007 07:45:14 -0800, Tim Kelley <tk*****@company.comwrote:
[...] I believe that using the open file dialog is
changing the working directory and causing the error. Is there a way to
save the working directory, do the open file dialog and then reset the
working directory to its original state?
Yes. Set the RestoreDirectory property to "true" before calling
ShowDialog().

There are other ways to solve the problem, but it seems to me that's the
simplest.

Pete
Dec 18 '07 #3

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

Similar topics

1
5344
by: Jason Charalambides | last post by:
Hi, I wanted to do the following: 1. Save a file as "Tensegrity.tmp" in my C:\Temp directory (and if one exists to replace it without any interaction, asking me about it etc.) 2. Once this is...
138
6399
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the...
5
2622
by: Patrick | last post by:
Hello - I am working on a program that creates a small temp file. The ideal would be it creates the file in the user %temp% directory - whatever that is - the default is %USERPROFILE%\Local...
3
3193
by: smita | last post by:
Hi, I am trying to write to an Xml document. My xml file is present is in the current working directory but whenever i try to make changes to the file and save the change in the XML file (which...
0
1411
by: soberhi | last post by:
I am new to Access (and Access programming) so kindly be gentle. I did try to search around before asking this question. I am simplifying my problem in the hopes that this scaled down version...
3
1717
by: Clay Black | last post by:
I need to find a way to save an HTML page to the IIS server. What I need is to have a button that once it is clicked the current page being displayed is saved to a location on the local IIS...
3
3176
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current...
3
1737
by: Nathan Guill | last post by:
I have an interface that works with an Access back-end. I would like to store and/or load user defined query strings per each user (i.e. no user can access another's queries). The idea I had was...
0
935
by: Newbie5555 | last post by:
I'm having problem with my current webmaster. Iooking at changing. Current webmaster says he and only he can do the resetting licensing on the controls we use. Is that true? I can't get a stranght...
0
6978
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
7154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7190
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...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.