PC Review


Reply
Thread Tools Rate Thread

Current Directory Selected from OpenFileDialogBox?

 
 
JS
Guest
Posts: n/a
 
      9th Jan 2005
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


 
Reply With Quote
 
 
 
 
Chris R. Timmons
Guest
Posts: n/a
 
      9th Jan 2005
"JS" <(E-Mail Removed)> wrote in
news:bG1Ed.1994$(E-Mail Removed):

> 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]);

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change current directory to the directory that the workbook loads from! alondon Microsoft Excel Programming 5 17th Apr 2007 06:05 AM
Current Directory (System.IO.Directory.GetCurrentDirectory throws NotSupportedexeption) Gustavo Curve Microsoft Dot NET Compact Framework 2 17th Feb 2006 02:54 PM
OpenFileDialogBox on Web Page Michael Murphy Microsoft ASP .NET 4 22nd Nov 2004 09:11 PM
changing current directory to that of the current open file unnameable Microsoft Excel Programming 2 19th May 2004 11:14 AM
Directory starting witht the Current Directory Neeraja Microsoft Excel Worksheet Functions 1 18th Sep 2003 05:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:47 AM.