1

Through ways I don't understand, whenever I open my CommonOpenFileDialog it opens to the last directory I was in. Awesome! I'd like to access this directory's path string before I open the dialog to show the current directory on screen. Is there a way to do this?

I've tried the following, but get an empty string.

var dialog = new CommonOpenFileDialog();
        outputPathTextBox.Text = dialog.InitialDirectory;
        dialog = null;
NSouth
  • 5,067
  • 7
  • 48
  • 83
  • Whats wrong with saving the filename the time you close the FileDialog. The next time you'll have it without bothering the FileDialog – coder0815 Oct 13 '14 at 15:10
  • Nothing is wrong with that and that's what I ended up doing. I just thought that since the dialog seemed to know it anyway it would be cleaner to use its knowledge than track it myself. No big deal. – NSouth Oct 13 '14 at 15:17

0 Answers0