0
Answer

File.Exists() vs. OpenFileDialog() issue

Ask a question
davidh1

davidh1

20y
4k
1
Hello, If I use File.Exists("filename.xxx") it looks in the same directory as the executable is located in (bin\debug in this case). This is what I would expect. However, when I use OpenFileDialog() in my Windows-Form C# application and navigate around to move to some folder, and locate the file I need this way, it REMEMBERS the directory next time I run the application. But I have done nothing to make this happen. I am running within VS.NET 2000 in debug mode. Don't know if that has anything to do with it. Where is this value kept (the "old directory"). In VS.NET? The Registry? ??? Ideally I would like to retrieve the value next time the application is executed and change my current directory to that location so File.Exists("filename.xxx") will look in the same folder as OpenFileDialog() will start in. Using debug, the attribute "Initial Directory" in the dialog instance is still blank (""). Dave