I have 2 buttons and I read different files when I click on these buttons. I used to display readfile with MsgBox, since the files are large, so I want to display it in richTextBox.
How can I open richTextBoxand display read filewhen I click on any of these buttons ???
private void button1_Click(object sender, EventArgs e)
{
DisplayFile(FileSelected);
var ReadFile = XDocument.Load(FileSelected);
MessageBox.Show("The Selected" + " " + FileSelected + " " + "File Contains :" + "\n " + "\n " + ReadFile);
button1.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
FileInfo file = (FileInfo)comboBox2.SelectedItem;
StreamReader FileRead = new StreamReader(file.FullName);
string FileBuffer = FileRead.ReadToEnd();
}
Is there any other way to do this?
source
share