.net OpenFileDialog changing the CurrentDirectory
I am using OpenFileDialog
. But using it changes the Environment.CurrentDirectory
.
Using the RestoreDirectory
property solves this issue, but I'm using external dlls that I can't control that don't use RestoreDirectory
.
Is there a way t开发者_如何学Co make it true as default? Or is there any other solution to this annoying problem?
Thanks.
Saving the current path and restoring it after the dialog has been shown would do the trick imo:
var currentDir = Environment.CurrentDirectory;
// Show File open dialog etc ...
Environment.CurrentDirectory = currentDir;
精彩评论