怎样用代码实现对richTextBox1.Text的保存 我新建了一个文本文档,其路径是C:\\Documents and Settings\\student\\桌面\\文本编辑器\\新建文本文档.txt我想将richTextBox1.Text保存在新建文本文档.txt中,要怎样用代码实现?请大家帮帮忙啊!急用啊!!!!!!!!!!!!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void btsaveas_Click(object sender, System.EventArgs e) { try {saveFileDialog1.FileName=textBox2.Text; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { StreamWriter asw = new StreamWriter(saveFileDialog1.FileName, true,System.Text.Encoding.Default); asw.Write(richTextBox1.Text); asw.Close(); } } catch(Exception ex) { MessageBox.Show(ex.Message ,"错误",MessageBoxButtons.OK,MessageBoxIcon.Error ); } } richTextBox1.SaveFile(@"C:\\Documents and Settings\\student\\桌面\\文本编辑器\\新建文本文档.txt",RichTextBoxStreamType.PlainText); richTextBox1.SaveFile(@"C:\\Documents and Settings\\student\\桌面\\文本编辑器\\新建文本文档.txt",RichTextBoxStreamType.PlainText);这个写法………………前面有@的字符串内部不需要用\\来表示\ richTextBox1.SaveFile("C:\\Documents and Settings\\student\\桌面\\文本编辑器\\新建文本文档.txt",RichTextBoxStreamType.PlainText); C#语音开发 请教遨游浏览器的那个设置框是怎么做的啊 如何往串口上发一个CTRL+Z类似的组合键呢? asp.net2005打包安装发布的问题. 如何将多个参数传递到一个指定的URL上? 求救!!!在线等待中... 谁能解释一下什么是“挂起的布局请求”?谢谢 怎么查找AD中某个域用户的其他信息? 用C#写的aspx网页不能随着我的修改而更新页面!!各位大侠、版主救命啊! java & dotnet 未找到组件。。。。(100分求解) winform中如何添加一个视频或音频,请大大们帮忙!小弟在线等
{
try
{
saveFileDialog1.FileName=textBox2.Text;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamWriter asw = new StreamWriter(saveFileDialog1.FileName, true,System.Text.Encoding.Default);
asw.Write(richTextBox1.Text);
asw.Close();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message ,"错误",MessageBoxButtons.OK,MessageBoxIcon.Error );
}
}