C# 的richTextBox.LoadFile无法打开纯文本文件,是怎么回事
privatevoidbutton1_Click(objectsender,EventArgse){if(openFileDialog1.ShowDialog()==Di...
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (richTextBox1.Text != null)
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.TextTextOleObjs);
}
可以保存不能打开,即便是保存输入的内容为.txt,因为不能打开,按f5然后打开说文件格式错误,再然后就挂了 展开
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (richTextBox1.Text != null)
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.TextTextOleObjs);
}
可以保存不能打开,即便是保存输入的内容为.txt,因为不能打开,按f5然后打开说文件格式错误,再然后就挂了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询