
C# 中 SaveFileDialog打开后如何显示默认文件名 而这个文件名是textBox1中的内容
FolderBrowserDialogfolderSaveDlg=newFolderBrowserDialog();if(folderSaveDlg.ShowDialog...
FolderBrowserDialog folderSaveDlg = new FolderBrowserDialog();
if (folderSaveDlg.ShowDialog() == DialogResult.OK)
{string saveFolderPath = folderSaveDlg.SelectedPath;
string sourceFolderPath = string.Empty;
string sourceFileList = this.textBox1.Text;
if (sourceFileList.EndsWith(";"))
{ sourceFileList = sourceFileList.Substring(0, sourceFileList.Length - 1);}
string[] strArray = sourceFileList.Split(';');
if (strArray.Length > 0)
{
sourceFolderPath = System.IO.Path.GetDirectoryName(strArray[0]); // Get Source Folder Name
}
for (int i = 0; i < strArray.Length; i++)
{string destFilePath = string.Format(@"{0}\{1}", saveFolderPath, System.IO.Path.GetFileName(strArray[i]));
this.comboBoxSaveFileList.Items.Add(destFilePath);
System.IO.File.Copy(strArray[i], destFilePath); } }正确写法 多谢一楼的帮助啊! 展开
if (folderSaveDlg.ShowDialog() == DialogResult.OK)
{string saveFolderPath = folderSaveDlg.SelectedPath;
string sourceFolderPath = string.Empty;
string sourceFileList = this.textBox1.Text;
if (sourceFileList.EndsWith(";"))
{ sourceFileList = sourceFileList.Substring(0, sourceFileList.Length - 1);}
string[] strArray = sourceFileList.Split(';');
if (strArray.Length > 0)
{
sourceFolderPath = System.IO.Path.GetDirectoryName(strArray[0]); // Get Source Folder Name
}
for (int i = 0; i < strArray.Length; i++)
{string destFilePath = string.Format(@"{0}\{1}", saveFolderPath, System.IO.Path.GetFileName(strArray[i]));
this.comboBoxSaveFileList.Items.Add(destFilePath);
System.IO.File.Copy(strArray[i], destFilePath); } }正确写法 多谢一楼的帮助啊! 展开
1个回答
展开全部
saveFileDialog.FileName = textBox1.Text;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询