0

I want to change the text color programmatically.

eg;

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?

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by gusano79
0

Impossible.
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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.