Control for picking a folder?

M

Mike Litzkow

I want my user to pick a folder where my code will "walk"
the subtrees and process many files. The FileDialog,
OpenFileDialog, and related classes seem to only want to
pick one or more files (not folders). I wonder if it is
possible to add event handlers or override methods in one
of these classes to accomplish this task. I tried
intalling an event handler for the "FileOk" event
in "OpenFileDialog". The docs say that this event will
be fired when the user clicks on the "Open" or "Save"
button, but my handler never gets called. Has anybody
else dealt with this problem?
--- mike
 
H

Herfried K. Wagner [MVP]

* "Mike Litzkow said:
I want my user to pick a folder where my code will "walk"
the subtrees and process many 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 P/Invoke solutions mentioned below
instead.

..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>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
T

Thomas W. Brown

-----Original Message-----
I want my user to pick a folder where my code will "walk"
the subtrees and process many files. The FileDialog,
OpenFileDialog, and related classes seem to only want to
pick one or more files (not folders). I wonder if it is
possible to add event handlers or override methods in one
of these classes to accomplish this task. I tried
intalling an event handler for the "FileOk" event
in "OpenFileDialog". The docs say that this event will
be fired when the user clicks on the "Open" or "Save"
button, but my handler never gets called. Has anybody
else dealt with this problem?
--- mike
.

Check out the FolderBrowserDialog object from the Windows
Forms toolbox. While I haven't yet had the need to use
it, I'm betting that it is exactly what you're looking for.

-- TB
 

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