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