RichTextBox auto scroll to bottom when replacing a line
<p>I'm using a <code>richtexbox</code> to put logs for an application of mine. I'm also using it as some sort of progress bar for a background worker.</p>

<p>I'm not going to go in to detail but the application loops through several devices and gather data, the current data being processed is displayed on the last line of the richtextbox and is replaced every time a new one is processed.</p>

<p>Here's a small sample of the log.</p>

<pre><code>Found 239 record(s), Transferred 239 record(s) from: 10.10.10.10 - 10/24/2016 7:37:45 PM
Found 42 record(s), Transferred 42 record(s) from: 10.10.10.11 - 10/24/2016 7:37:58 PM
43593...
</code></pre>

<p>The last line would be replaced by some other data while processing. Until it's finished and replaced again like this.</p>

<pre><code>Found 239 record(s), Transferred 239 record(s) from: 10.10.10.10 - 10/24/2016 7:37:45 PM
Found 42 record(s), Transferred 42 record(s) from: 10.10.10.11 - 10/24/2016 7:37:58 PM
Found 2 record(s), Transferred 2 record(s) from: 10.10.10.12 - 10/24/2016 7:38:03 PM
986035...
</code></pre>

<p>I add data to the richtextbox using <code>AppendText</code>, this works fine and scrolls the richtextbox to the bottom when I add new records. But for my "progress bar" I replace the last line like this:</p>

<pre><code>Me.rtbLogs.Rtf = Me.rtbLogs.Rtf.Replace(Me.rtbLogs.Lines(rtbLogs.Lines.Length - 1), e.UserState.ToString())
</code></pre>

<p>Everything works fine except while it's replacing texts the richtextbox scrolls back to the top.</p>