title: C# Bold a part of a string in a RichTextBox
body: <p>I am trying to bold the <code>"You &gt;&gt;"</code> part of this string to be displayed in a rich text box.</p>
  
  <p>The following is my code for when the message send button is clicked. <code>displayBox</code> is where id like the string to be bold, <code>entryBox</code> is where the user is entering a message.</p>
  
  <pre><code>        private void button1_Click(object sender, EventArgs e)
      {
          listData.Add(entryBox.Text);
          // Remove the linebreak caused by pressing return
          SendKeys.Send("\b");
  
  
          // Empty the array string
          ArrayData = "";
  
          // Bold the You &gt;&gt;
          displayBox.SelectionStart = 0;
          displayBox.SelectionLength = 6;
          displayBox.SelectionFont = new Font(displayBox.Font, FontStyle.Bold);
          displayBox.SelectionLength = 0;
  
          foreach (string textItem in listData)
          {
              ArrayData = ArrayData + "You &gt;&gt; " + textItem + "\r\n";
          }
          entryBox.Focus();
          displayBox.Text = "";
          displayBox.Refresh();
          displayBox.Text = ArrayData;
          entryBox.Text = "";
  
      }
  </code></pre>
  
  <p>Any help would be great on this.</p>