Hi I was messing around with a richtextbox and I was wondering if there is a way where I can highlight a specific line or row if you want to call it. This will include all the text in that line.
Printable View
Hi I was messing around with a richtextbox and I was wondering if there is a way where I can highlight a specific line or row if you want to call it. This will include all the text in that line.
Play around with this...
http://www.vbforums.com/showthread.p...ht=richtextbox
GDO, this wil chage font color of currnt line
just check and feedback meCode:Dim lBegin As Long, lEnd As Long
Dim CurPos As Long
With RichTextBox1
CurPos = .SelStart
If CurPos = 0 Then CurPos = 1
'Find line begin and end
lBegin = InStrRev(.Text, vbCrLf, CurPos)
lEnd = InStr(CurPos, .Text, vbCrLf)
If lBegin = 0 Then lBegin = -1
If lEnd = 0 Then lEnd = Len(.Text) - 1
.SelStart = lBegin + 1
.SelLength = lEnd - lBegin
.SelColor = vbRed
End With