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.
Wednesday, May 23, 2007
Folder Browsing --- Easy way 2
Chris Anderson suggested to use FolderNameEditor which in System.Design.dll
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(13)
-
▼
May
(12)
- MessageBox with more options in C#
- Error Report Example in C#
- Error Report Example in C++
- Ascii to Hex in C#
- Hex to Ascii Conversion in C#
- C# File Open, Save in .Net Framework and Compact F...
- C++ File Open, save in .Net Compact Framework
- How to do a folder browing in .Net Compact Framework?
- Folder Browsing --- Easy way 2
- Folder Browsing --- Easy way 1
- Microsoft way to do folder browsing
- How to do a folder browsing in C#?
-
▼
May
(12)
No comments:
Post a Comment