C# 如何提取richtextbox中的特定内容并保存到一个文件里 55
3个回答
展开全部
方法一:
private void open_Click(object sender, EventArgs e)
{
OpenFileDialog opfd = new OpenFileDialog();
if (opfd.ShowDialog() == DialogResult.OK) {
//需要是固定的格式
richTextBox1.LoadFile(opfd.FileName,RichTextBoxStreamType.RichText);
}
}
private void save_Click(object sender, EventArgs e)
{
//保存
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
richTextBox1.SaveFile(sfd.FileName);
}
}
方法二:Using system.IO;
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
StreamWriter sw=new StreamWriter (sfd.FileName);
sw.Write(RichTextBox.Text);
}
}
private void open_Click(object sender, EventArgs e)
{
OpenFileDialog opfd = new OpenFileDialog();
if (opfd.ShowDialog() == DialogResult.OK) {
//需要是固定的格式
richTextBox1.LoadFile(opfd.FileName,RichTextBoxStreamType.RichText);
}
}
private void save_Click(object sender, EventArgs e)
{
//保存
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
richTextBox1.SaveFile(sfd.FileName);
}
}
方法二:Using system.IO;
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
StreamWriter sw=new StreamWriter (sfd.FileName);
sw.Write(RichTextBox.Text);
}
}
展开全部
方法一:
private void open_Click(object sender, EventArgs e)
{
OpenFileDialog opfd = new OpenFileDialog();
if (opfd.ShowDialog() == DialogResult.OK) {
//需要是固定的格式
richTextBox1.LoadFile(opfd.FileName,RichTextBoxStreamType.RichText);
}
}
private void save_Click(object sender, EventArgs e)
{
//保存
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
richTextBox1.SaveFile(sfd.FileName);
}
}
方法二:Using system.IO;
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
StreamWriter sw=new StreamWriter (sfd.FileName);
sw.Write(RichTextBox.Text);
}
}
private void open_Click(object sender, EventArgs e)
{
OpenFileDialog opfd = new OpenFileDialog();
if (opfd.ShowDialog() == DialogResult.OK) {
//需要是固定的格式
richTextBox1.LoadFile(opfd.FileName,RichTextBoxStreamType.RichText);
}
}
private void save_Click(object sender, EventArgs e)
{
//保存
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
richTextBox1.SaveFile(sfd.FileName);
}
}
方法二:Using system.IO;
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK) {
StreamWriter sw=new StreamWriter (sfd.FileName);
sw.Write(RichTextBox.Text);
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询