查找文件路径
private void stackPanel1_Click(object sender, EventArgs e)
{
//查找文件路径
OpenFileDialog d = new OpenFileDialog();
if (d.ShowDialog() == true) // Result could be true, false, or null
folderName = d.FileName;
textBox1.Text = folderName;
}
查找文件夹路径
必须手动加载 System.Windows.Forms.dll
浏览添加:
C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Windows.Forms.dll
FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
if (folderBrowser.ShowDialog() == DialogResult.OK)
{
DataStore.AddFolder(folderBrowser.SelectedPath);
}