Hi Member 12896541,
Literally what you want is not achievable by TextBox. If you really need that color mechanism, you need to use a rich text box. The answer is already given here: c# - RichTextBox different back color for each line - Stack Overflow
A RichTextBox control has
enumerator that can be manipulated to get a reference to each line in the box. Then you need to select the entire line using the
and the line length property. Finally you need a mechanism to set color for every odd and even line; you can use a modulus operator.
int LineCount = 0;
foreach (string line in richTextBox1.Lines)
richTextBox1.SelectionColor = (LineCount++ % 2 == 0) ? Color.Red : Color.Green;
Please check here as a reference:
RichTextBox.SelectionColor Property (System.Windows.Forms)
Also check the 5 points mentioned by Philippe. These are good suggestions; so please change the code accordingly.