标题:[求助]如何通过saveFileDialog把textbox中的内容写入文件
只看楼主
unpowertome
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-5-6
得分:0 
openFileDialog1.Filter="txt(*.txt)|*.txt|allfill(*.*)|*.*";
openFileDialog1.FilterIndex=1;
openFileDialog1.RestoreDirectory=true;
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{
this.crystalReportViewer1.ReportSource=openFileDialog1.FileName;
}

2007-05-06 12:39
unpowertome
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-5-6
得分:0 
SaveFileDialog sd=new SaveFileDialog();
sd.Filter="txt(*.txt)|*.txt|allfill(*.*)|*.*";
sd.RestoreDirectory=true;
if(sd.ShowDialog()==DialogResult.OK)
{
string flname=sd.FileName;
StreamWriter sw=new StreamWriter(flname);
sw.Write(this.textBox1.Text);
sw.Flush();
sw.Close();
}

2007-05-06 12:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-14963-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.167353 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved