Search code examples
c#.netwinformsrichtextbox

Adding strings to a RichTextBox in C#


I currently have a function that will set a value to a RichTextBox, although how could you "add" a value or a new line to it, rather than overwriting existing data in the RichTextBox?

richTextBox2.Text = DateTime.Today + " Hello";

Solution

  • richTextBox2.AppendText(Environment.NewLine + DateTime.Today + " Hello");