public class BrowseForFolder : FolderNameEditor
{
// inherit the FolderNameEditor class
FolderNameEditor.FolderBrowser fBrowser;
public BrowseForFolder()
{
// contructor
// create an instance of FolderBrowser
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();
}
}
Usage:
BrowseForFolder test = new BrowseForFolder();
string sPath = test.ShowIt("Easyone!");
MessageBox.Show(sPath);
Key: you have to reference the System.Design.dll (C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322)to be able to access the FolderNameEditor namespace.
Note: still not available for Compact Framework.
Showing posts with label FolderNameEditor. Show all posts
Showing posts with label FolderNameEditor. Show all posts
Wednesday, May 23, 2007
Folder Browsing --- Easy way 2
Chris Anderson suggested to use FolderNameEditor which in System.Design.dll
Subscribe to:
Posts (Atom)