SaveFileDialog控件的用法 SaveFileDialog控件的用法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SaveFileDialog saveFileDialog = new SaveFileDialog();if (saveFileDialog.ShowDialog() == DialogResult.OK){ string fileName = saveFileDialog.FileName; //这里写保存代码,fileName就是文件的路径。} 我的代码:if (this.saveFileDialog1.ShowDialog() == DialogResult.OK ){ //MessageBox.Show(sFileName); //写入文件 string sFileName; FileStream fs; StreamWriter sw; sFileName = this.saveFileDialog1.FileName; fs = new FileStream(sFileName,FileMode.Create); sw = new StreamWriter(fs,System.Text.Encoding.Default); ... //写入文件 sw.WriteLine(dr.GetValue(4).ToString() ); sw.Close(); fs.Close();} private void exportXLS_Click(object sender, EventArgs e) { SaveFileDialog fd = new SaveFileDialog(); fd.Title = "导出Excel文件"; fd.RestoreDirectory = true; fd.Filter = "Excel文件|*.xls"; fd.FilterIndex = 1; if (fd.ShowDialog() == DialogResult.OK) { this.gridView1.ExportToXls(fd.FileName); XtraMessageBox.Show("文件导出成功", "导出", MessageBoxButtons.OK, MessageBoxIcon.Information); } } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Execl files (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; saveFileDialog.CreatePrompt = true; saveFileDialog.Title = ""; saveFileDialog.FileName =""; saveFileDialog.ShowDialog(); http://msdn.microsoft.com/zh-cn/library/system.windows.forms.savefiledialog(VS.80).aspx 求助ACTIVEX内弹出窗口的传值问题 【初学者求教】怎样判断行的奇数偶数 .net 错误信息没了?? 存储AutoCAD(.dwg)文件到sql server? 使用checkbox在datagridview里选择同时删除多行的问题 ToString()方法如何用 如何得到应用程序所在的路径和当前工作路径 如何不使用InstallUtil安装服务 webservice与类库有什么区别?谁更优? 除了全局变量,后端有没有类似于localStorage这样好用的缓存? 我看WWF这章怎么是一头雾水?。。。 ASP富文本编辑器
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
string fileName = saveFileDialog.FileName;
//这里写保存代码,fileName就是文件的路径。
}
if (this.saveFileDialog1.ShowDialog() == DialogResult.OK )
{
//MessageBox.Show(sFileName);
//写入文件
string sFileName;
FileStream fs;
StreamWriter sw;
sFileName = this.saveFileDialog1.FileName;
fs = new FileStream(sFileName,FileMode.Create);
sw = new StreamWriter(fs,System.Text.Encoding.Default); ...
//写入文件
sw.WriteLine(dr.GetValue(4).ToString() );
sw.Close();
fs.Close();
}
{
SaveFileDialog fd = new SaveFileDialog();
fd.Title = "导出Excel文件";
fd.RestoreDirectory = true;
fd.Filter = "Excel文件|*.xls";
fd.FilterIndex = 1;
if (fd.ShowDialog() == DialogResult.OK)
{
this.gridView1.ExportToXls(fd.FileName);
XtraMessageBox.Show("文件导出成功", "导出", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
saveFileDialog.Filter = "Execl files (*.xls)|*.xls";
saveFileDialog.FilterIndex = 0;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.CreatePrompt = true;
saveFileDialog.Title = "";
saveFileDialog.FileName ="";
saveFileDialog.ShowDialog();
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.savefiledialog(VS.80).aspx