Advertisement
Java_Volume1 Files/ File Controls/ Input/ Output #103181

BrowseForFolder class

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.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
// 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(); 
	}
}
Komentar Asli (3)
Dipulihkan dari Wayback Machine