What does the FileDialog.RestoreDirectory Property actually do?

delete picture delete · Dec 4, 2010 · Viewed 12.7k times · Source

I've read about the property on MSDN, but I still don't understand what it does.

Gets or sets a value indicating whether the dialog box restores the current directory before closing.

What exactly does that mean? What does 'restoring' the current directory actually do? Thanks for the help.

Answer

digEmAll picture digEmAll · Dec 4, 2010

IIRC, in windows XP when you press Save on a SaveFileDialog (or Open on a OpenFileDialog) the directory where the file is saved (or opened), is set as the new current working directory (the one in Environment.CurrentDirectory).

By setting FileDialog.RestoreDirectory = true, when you close the FileDialog the original working directory is restored.

In Windows Vista/Seven the behavior is always as FileDialog.RestoreDirectory = true (yes, even if you set it to false...).