title: How do I avoid having my Rich Text Box, "scroll bar," freeze up?
body: <p>My issue is in the .NET framework using C# to create a simple form application that contains a <em>rich text box</em> (RTB) control.</p>
  
  <p>Briefly the issue I am experiencing is that when trying to clear the contents (.Text) of the RTB, the scroll bar doesn't go away. I would like to know if there is anything inherently wrong with the way I am using the RTB. I apologize, but the site will <strong>not allow me</strong> to post images yet. So if there is a misunderstanding regarding what "doesn't go away" means, please ask!</p>
  
  <p>So first, I write data to the box using the following code snippet:</p>
  
  <pre><code>// append the new message
  this.rtb_receive_0.Text += message;
  this.rtb_receive_0.SelectionStart = this.rtb_receive_0.Text.Length;
  this.rtb_receive_0.ScrollToCaret();
  </code></pre>
  
  <p>Later on, I clear the RTB contents (RTB.Text) with the following code:</p>
  
  <pre><code>this.rtb_receive_0.Text = String.Empty;
  this.rtb_receive_0.Refresh();
  </code></pre>
  
  <p>In the above code I have <em>attempted</em> to fix my problem with the, "Refresh," method. However it does not seem to be doing the job.</p>
  
  <p>When I clear the RTB contents, the scroll bar does not go away... I noticed that if I grab another window and drag it over the top of the application, that the frozen scroll bar disappears. Also, I can minimize the application, then maximize it again and the bar will disappear. There has to be a way to prevent this frozen scroll bar from happening in the first place though.</p>
  
  <p>Per the answer, here was the fix to stop the bar from freezing up:</p>
  
  <pre><code>this.rtb_receive_0.Text = String.Empty;
  this.rtb_receive_0.Clear();
  this.rtb_receive_0.ScrollBars = RichTextBoxScrollBars.None;
  this.rtb_receive_0.ScrollBars = RichTextBoxScrollBars.Vertical;
  this.rtb_receive_0.Refresh();
  </code></pre>