Current Directory Selected from OpenFileDialogBox?

  • Thread starter Thread starter JS
  • Start date Start date
J

JS

Does anybody know how I can get the just the selected directory from an
OpenFileDialogBox?

I have tried GetDirectoryName and GetFullPath, but these two require that I
manually input in the code the directory I'm trying to retrieve. What I'm
trying to do is allow the user to select a multiple files (which works fine)
and be able to tell which directory the selected files came from.

I thought that this would be an easy thing to do but, I cannot find any
solutions to this anywhere in the newsgroups or google.


Thanks,

JS
 
Does anybody know how I can get the just the selected directory
from an OpenFileDialogBox?

I have tried GetDirectoryName and GetFullPath, but these two
require that I manually input in the code the directory I'm
trying to retrieve. What I'm trying to do is allow the user to
select a multiple files (which works fine) and be able to tell
which directory the selected files came from.

I thought that this would be an easy thing to do but, I cannot
find any solutions to this anywhere in the newsgroups or google.

JS,

The path can be retrieved from one of the selected files:

string path;

if (_openFileDialog.FileNames.Length > 0)
path = Path.GetDirectoryName(_openFileDialog.FileNames[0]);
 
Back
Top