private void SaveFileDialog()
{
//string localFilePath, fileNameExt, newFileName, FilePath;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
//设置文件类型
saveFileDialog1.Filter = " txt files(*.txt)|*.txt|All files(*.*)|*.*";
//设置默认文件类型显示顺序
saveFileDialog1.FilterIndex = 2;
//保存对话框是否记忆上次打开的目录
saveFileDialog1.RestoreDirectory = true;
//点了保存按钮进入
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
//获得文件路径
//localFilePath = saveFileDialog1.FileName.ToString();
//获取文件名,不带路径
//fileNameExt = localFilePath.Substring(localFilePath.LastIndexOf("\\") + 1);
//获取文件路径,不带文件名
//FilePath = localFilePath.Substring(0, localFilePath.LastIndexOf("\\"));
//给文件名前加上时间
//newFileName = DateTime.Now.ToString("yyyyMMdd") + fileNameExt;
//在文件名里加字符
//saveFileDialog1.FileName.Insert(1,"dameng");
System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile();//输出文件
}
}
转自网址:
http://blog.csdn.net/free4294/article/details/7048166
参考网址:
http://www.cnblogs.com/smile-wei/archive/2012/07/04/2575630.html
{
//string localFilePath, fileNameExt, newFileName, FilePath;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
//设置文件类型
saveFileDialog1.Filter = " txt files(*.txt)|*.txt|All files(*.*)|*.*";
//设置默认文件类型显示顺序
saveFileDialog1.FilterIndex = 2;
//保存对话框是否记忆上次打开的目录
saveFileDialog1.RestoreDirectory = true;
//点了保存按钮进入
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
//获得文件路径
//localFilePath = saveFileDialog1.FileName.ToString();
//获取文件名,不带路径
//fileNameExt = localFilePath.Substring(localFilePath.LastIndexOf("\\") + 1);
//获取文件路径,不带文件名
//FilePath = localFilePath.Substring(0, localFilePath.LastIndexOf("\\"));
//给文件名前加上时间
//newFileName = DateTime.Now.ToString("yyyyMMdd") + fileNameExt;
//在文件名里加字符
//saveFileDialog1.FileName.Insert(1,"dameng");
System.IO.FileStream fs = (System.IO.FileStream)saveFileDialog1.OpenFile();//输出文件
}
}
转自网址:
http://blog.csdn.net/free4294/article/details/7048166
参考网址:
http://www.cnblogs.com/smile-wei/archive/2012/07/04/2575630.html