C# 打开文件夹、打开文件并返回文件、文件夹路径


C#实现【选择文件夹的保存路径】

private static string OpenFolderAndSelectFile()
{
string FolderPath = null;
FolderBrowserDialog FbDialog = new FolderBrowserDialog();
DialogResult result = FbDialog.ShowDialog();
if (result == DialogResult.OK)
{
FolderPath = FbDialog.SelectedPath;
}

return FolderPath;
}

 

 

C#实现【选择mdb文件的保存路径】

public static string WsPath()
{
string WsFileName = "";
OpenFileDialog OpenFile = new OpenFileDialog();
OpenFile.Filter = "个人数据库(MDB)|*.mdb";
DialogResult DialogR = OpenFile.ShowDialog();
if (DialogR == DialogResult.Cancel)
{

}
else
{
WsFileName = OpenFile.FileName;
}
return WsFileName;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM