I want to change the text color programmatically.


textBox1.Forecolor = Color.Red;
textBox1.AppendText("Red Text/n");

textBox1.Forecolor = Color.Green;
textBox1.AppendText("Green Text/n");

The problem is, this changes the entire text to green where I want to have the two different lines in two different colors.

Can someone help?

You cannot have two different colors in textBox control.
To have multiple rows and beside multiple colors, you can use listBox for instance.
Take a look at here for an instance.

Okay, this is actually possible but requires a little math and some basic method writing. The reason I say this, is because programs like Microsoft Word allow you to do it. Although I don't think they are using a textBox control either. I'll look into it this afternoon; I'm actually headed to my Calc3 class. So good luck, and if you don't have it when I get back I'll look into it. This actually interests me.

You're looking for the RichTextBox control.

Pro tip: Search the forums. See this post for an example of multicolored text in a RichTextBox.