Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - displaying lots of text in WinForm

Tags:

c#

winforms

I want to be able to display process update information to a user. The way I want to do this is by having a control on the main winform that (at a yet undecided process) keeps the user informed via text of what the status is. I want this text to scrollup (within a control) as more text is added.

What is the best way to achieve this?

like image 416
darren young Avatar asked Dec 29 '22 06:12

darren young


1 Answers

Use a multiline TextBox, like so:

myTextBox.Multiline = true;

And update it while scrolling to the bottom, like so:

myTextBox.Text += "My message" + System.Environment.NewLine;
myTextBox.SelectionStart = myTextBox.Text.Length;
myTextBox.ScrollToCaret();
like image 61
BaBu Avatar answered Jan 14 '23 07:01

BaBu