Reputation: 1267
I'm looking for C#.net code to scroll a richtextbox programmatically, I have searched about it but I found some examples of VB.Net but don't know how to use them. any help would be highly appreciated. Thanks in Advance :)
Upvotes: 1
Views: 918
Reputation: 639
If I properly understand, you want to scroll richtextbox to the bottom after new lines were added to this control. Just add this code to method that runs each time you add some new data:
private void AddText(string text)
{
richTextBox1.AppendText(text + Environment.NewLine);
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.ScrollToCaret();
}
Upvotes: 2