如何仅使用“保存文件对话框”获取文件名?
MessageBox.Show("File was created with name: " + SOME CODE HERE +
Environment.NewLine + Environment.NewLine +
"You can find it at: " + Environment.NewLine + sfdNewFile.FileName);
答案 0 :(得分:6)
见
System.IO.Path.GetFileName;
您可以使用参数sfdNewFile.FileName
答案 1 :(得分:5)
使用:
System.IO.Path GetFileName(sfdNewFile.FileName);
示例:
MessageBox.Show("File was created with name: " + SOME CODE HERE +
Environment.NewLine + Environment.NewLine +
"You can find it at: " + Environment.NewLine + System.IO.Path.GetFileName(sfdNewFile.FileName));