Showing posts with label Winform. Show all posts
Showing posts with label Winform. Show all posts

Wednesday, November 05, 2008

How to Show File Dialog

Here is some code to allow users to select Folder.

public class FolderBrowser : FolderNameEditor
{
private FolderNameEditor.FolderBrowser m_obBrowser = null;
private string m_strDescription;
public FolderBrowser()
{
m_strDescription = "Select folder";
m_obBrowser = new FolderNameEditor.FolderBrowser();
}

public string DirectoryPath
{
get{return this.m_obBrowser.DirectoryPath;}
}

public DialogResult ShowDialog()
{
m_obBrowser.Description = m_strDescription;
return m_obBrowser.ShowDialog();
}
}