I need to change the color of each line of a rich text box as each line of code is added. Could someone please help me out with some code.

This is for a chat program.