title: Reset RTF formatting in a WinForms RichTextBox without discarding its text?
body: <p>I'm trying to "reset" the formatting in my RichTextBox (WinForms, not WPF).  I was previously using </p>
  
  <pre><code>richTextBox.Text = richTextBox.Text;
  </code></pre>
  
  <p>However, that seems to have suddenly failed me.  Now no matter what I set <code>richTextBox.Text</code> to, it retains some of the rtf formatting.</p>
  
  <p>I've tried</p>
  
  <pre><code>richTextBox.Rtf = richTextBox.Text;
  </code></pre>
  
  <p>However, that complains about an incorrect format.  There's gotta be a better way to do this.  (Of course, selecting the entire thing, then resetting the back color, fore color, and font works, but that results in a flicker as the entire thing is selected then deselected, plus it's slower and requires a lot more code.)  Anyone have any idea?</p>
  
  <p>Edit:
  I've gotten this to work:</p>
  
  <pre><code>string tempTxt = richTextBox.Text;
  richTextBox.Clear();
  richTextBox.Text = tempTxt;
  </code></pre>
  
  <p>But there has to be a better way, right?</p>
  
  <p>Edit 2:
  To be clear, I wish to remove all formatting while retaining the text.  It looks like the code in the first edit will ship, unless anyone else has a more efficient/better coding way.</p>
  
  <p>Edit 3:</p>
  
  <pre><code>richTextBox.Text = richTextBox.Text.ToString();
  </code></pre>
  
  <p>doesn't seem to work because it still doesn't clear all the formatting.  The reason I don't like the method in the first Edit above is it makes the text box "flash" when it clears it then re-inputs the text.  It seems like there should simply be a richTextBox.ResetFormatting() method, or some way to access the same functionality, as the Clear() method clearly (no pun intended) does some sort of formatting reset in addition to simply clearing all the text.</p>
  
  <p>To summarize:</p>
  
  <p><strong>Is there a way (and if so, what is it) to reset the formatting of the text in a RichTextBox without clearing the text as in the example above (because that produces undesirable flashing)?</strong></p>