title: .NET - Long Line in RichTextBox Wrapped after 3,510 Characters
body: <p>I have a RichTextBox in a WInForms program that is wrapping any line that is longer than 3,510 characters.  I have WordWrap set to false, so all lines under that length extend normally without wrapping.  What I used to do to get around this was to set RightMargin to a high number such as 100,000, which still works, but now that I am on Windows 7 and not XP, I get a scroll bar that scrolls as though the text box had lines of that large length, when it doesn't.</p>
  
  <p>To replicate, just create a winforms program with a RichTextBox and Button.  In the button's click event, put the following:</p>
  
  <pre><code>        StringBuilder sb = new StringBuilder();
          for (int i = 0; i &lt; 3511; i++)
              sb.Append('A');
          richTextBox1.Text = sb.ToString();
  </code></pre>
  
  <p>After you see the wrapping, change the RightMargin of the text box to 100000, and notice the scrollbar that appears even before running the program (only on 7 and probably Vista).  The line no longer wraps, but I want the scrollbar to only act on the text in the box, and not some pre-determined length.</p>