VB icon

BrowseForFolder class

Email
Submitted on: 1/1/2015 3:19:00 AM
By: Chris Andersen (from psc cd)  
Level: Beginner
User Rating: By 7 Users
Compatibility: C#
Views: 2277
 
     More code from me shwoing the .NET way to do common things that used to require mucho API.. This is a BrowseForFolder class that uses the .NET framework only... Havent seen this done yet without API. Enjoy..and please vote if you like it and use it.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: BrowseForFolder class
// Description:More code from me shwoing the .NET way to do common things that used to require mucho API.. This is a BrowseForFolder class that uses the .NET framework only... Havent seen this done yet without API. Enjoy..and please vote if you like it and use it.
// By: Chris Andersen (from psc cd)
//**************************************

// created on 04/11/2002 at 6:29 PM
// by Chris Andersen using SharpDevelop http://www.icsharpcode.net
// This class give you the BrowseForfolder dialog without using the API.
// Sample usage
		/* BrowseForFolder test = new BrowseForFolder();
		
			MessageBox.Show(test.ShowIt("bwah"));
		*/
		
using System;
using System.Windows.Forms;
using System.Windows.Forms.Design;
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(); 
	}
}


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.