How to filter for Directory?

E

Elizabeth

Hi, I am looking for a way to present the user with a
OpenFileDialog or FileDialog which allows filtering for
directory objects rather than files.

The problem is...you cant say something like the
following:

Filter = FileAttributes.Directory

If possible to display directories only, can I also
present the path in the filename box as I move back and
forth in the file system using this file dialog, and use
the selected directory as an application variable later
on?

Thank you.

Ellie
 
H

Herfried K. Wagner [MVP]

* "Elizabeth said:
Hi, I am looking for a way to present the user with a
OpenFileDialog or FileDialog which allows filtering for
directory objects rather than files.

NET 1.1:

'System.Windows.Forms.FolderBrowserDialog'

Note that there is a bug in Fx 1.1 that causes a really bad error when
using a path which is longer than ~128 characters. This occurs on unicode
systems only. Use the PInvoke solutions mentioned below instead.

The property for hiding the button that allows the user to create a new
folder doesn't work on Windows 2000.

..NET 1.0:

<http://www.codeproject.com/cs/miscctrl/folderbrowser.asp>
<http://support.microsoft.com/?kbid=306285>
<http://www.gotdotnet.com/team/vb/FolderBrowser.exe>
<http://groups.google.com/groups?selm=q0JKzDbmCHA.2144@cpmsftngxa09>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top