Search:
Namespaces
Discussions
.NET v1.1
Feedback
Selecting a Path
Messages
Related Types
This message was discovered on
ASPFriends.com 'winforms-cs' list
.
Jim Toth
-- Moved from [aspngfreeforall] to [winforms-cs] by Let the good times roll <
Click here to reveal e-mail address
> --
I want to allow my users to select a path on their hard drive in which to save files (by default). I've looked at both the
OpenFileDialog
class and the
SaveFileDialog
class, but those both look like they operate on files and not on directories alone. Does anyone know of a built-in dialog that allows the user to select a path only?
- Jim
Reply to this message...
Erik Brown
ttJim,
This recently appeared on microsoft.public.dotnet.languages.csharp.
Haven't tried it, but should do what you want:
Erik
==========================================
public class BrowseForFolder :
FolderNameEditor
{
FolderNameEditor
.FolderBrowser fBrowser;
public BrowseForFolder()
{
fBrowser = new
System.Windows.Forms.Design.
FolderNameEditor
.FolderBrowser();
}
public string ShowIt(string textdescription)
{
// set the Description label
fBrowser.Description = textdescription;
fBrowser.ShowDialog(); // show the Windows
return fBrowser.DirectoryPath;// return whatever path choosen
}
~BrowseForFolder()
{
// destructor
fBrowser.Dispose();
}
}
[Original message clipped]
========
Erik Brown
Author of "Windows Forms Programming with C#"
http://www.amazon.com/exec/obidos/ASIN/1930110286t
Reply to this message...
System.Windows.Forms.Design.FolderNameEditor
System.Windows.Forms.OpenFileDialog
System.Windows.Forms.SaveFileDialog
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com