473,388 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Current Directory Selected from OpenFileDialogBox?

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
Nov 16 '05 #1
1 2293
"JS" <no@where.com> wrote in
news:bG*****************@newsread3.news.pas.earthl ink.net:
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/
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: The Roys | last post by:
Hi I have a need to be able to simulate a d/click on a Dir box item. When a certain event occurs I want the program to open up the directory above the current one selected and refresh. I can...
3
by: Daniel | last post by:
How do you get the current directory of the actual .exe file (not the file name but the directory it is in) ? These do not work: System.IO.Directory.GetCurrentDirectory() - returns system...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
8
by: Salad | last post by:
I designed a small app and I wanted to do a BrowseFolder (see http://www.mvps.org/access/api/api0002.htm), basically do a file open diaglog and select a directory/folder. The problem is that you...
3
by: Christopher Weaver | last post by:
I want to set a value in a specific field in the current row of a DataSet. This seems like the most basic thing to do but I can't find the syntax for identifying the current row. IOW, I can do...
0
by: Terry | last post by:
In short, I'm getting an IOException "Directory is not empty" if I have a Windows Explorer window open and have a subdirectory selected in the tree view. For example, I have a directory path of...
3
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current...
5
by: =?Utf-8?B?UGVy?= | last post by:
I want to change the current path in the OpenFileDialog in runtime. When the user presses OK-button I'm checking the selected path if it's valid for my application. If it's not valid I want to set...
2
by: Kakkanattu | last post by:
Hi, In desktop application, we use different ways to get the current execution directory. I. AppDomain.CurrentDomain.BaseDirectory II. Environment.CurrentDirectory...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.