问题描述
//加载文本
Stream Mystream;
OpenFileDialog openfiledialog1 = new OpenFileDialog();
if(openfiledialog1.ShowDialog()= = System.Windows.Forms.DialogResult.OK)
{
if((Mystream = openfiledialog1.OpenFile())!= null)
{
string strfilname = openfiledialog1.FileName;
string filetext = File.ReadAllText(strfilname);
richTextBox1.Text = filetext;
}
}
//loading text
Stream Mystream;
OpenFileDialog openfiledialog1 = new OpenFileDialog();
if (openfiledialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if ((Mystream = openfiledialog1.OpenFile()) != null)
{
string strfilname = openfiledialog1.FileName;
string filetext = File.ReadAllText(strfilname);
richTextBox1.Text = filetext;
}
}
推荐答案
这篇关于任何人都可以给我C#代码使用按钮在richtextbox中加载孟加拉文本文件并计算该文本文件中的单词数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!