Colored Text In RichTextBox

***?

mooman_fl said:
Ok... after posting the above example it finally sunk in what Iceplug was saying... and the correcton Otani made. I got it to work with this code:

Or for the sake of completeness here is the VB example:

Code:
Dim strTest As String() = New String() {"Line one", "Line two", "Line three", "Line four", "Line five"}
Dim clrTest As Color() = New Color() {Color.Red, Color.Blue, Color.Yellow, Color.Green, Color.Purple}
Dim i As Integer = 0
For Each s As String In strTest
 rtb1.SelectionColor = clrTest(i)
 rtb1.SelectedText = s + Environment.NewLine
 i += 1
Next[size=2][color=#0000ff][/color][/size]

I was after an answer for this program, and I tried ur code, and it kinda worked. it made the specified text the correct color - but when more text was added to the text bot - it reset the colored text to its original colour.

i have NFI why.

any help would be appreciated
 
Back
Top