title: Button click Open richTextBox and display the readfile
body: <p>I have 2 buttons and I read different files when I click on these buttons. I used the to display the readfile using <code>MsgBox</code>  since the files are big, so i want to display it in a <code>richTextBox</code>.</p>
  
  <p>How can I open a <code>richTextBox</code> and display the <code>read file</code> when I click on any one of these buttons???</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {  
      DisplayFile(FileSelected);//DisplayFile is the path of the file
      var ReadFile = XDocument.Load(FileSelected); //Read the selected file to display
  
      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(); //Read the selected file to display
  
      //MessageBox.Show("The Selected" + " " + file + " " +"File Contains :"  + "\n " + "\n " + FileBuffer);
      // richTextBox1.AppendText("The Selected" + " " + file + " " + "File Contains :" + "\n " + "\n " + FileBuffer);
      //richTextBox1.Text = FileBuffer;
  }
  </code></pre>
  
  <p>Is there any other way to do it?</p>