I have a multiline textbox and when I replace its text, the scroll bar goes to top ...
How can I prevent that and keep the scrollbar at the bottom like AppendText
method in textbox?
My code is as follows:
int milisecond = 100;
int persent = 0;
do
{
Random rnd = new Random();
int add = rnd.Next(1, 9);
int wait = rnd.Next(50, 1000);
textBox1.Text = textBox1.Text.Replace("Progress %" + persent, "");
persent += add;
if (persent > 100)
{
persent = 100;
}
textbox1.AppendText("Progress %" + persent);
Task.Delay(milisecond).Wait();
this.Refresh();
} while (persent != 100);