Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Richtextbox loses format when updated

Status
Not open for further replies.

DriesM

Programmer
Nov 25, 2001
16
BE
Hello,

I have this problem with a richtextbox, wich I use to create a chat client control in VB6.0. I want to add colors wich are included in the incoming data stream. But everytime a colored text is added, it loses his color property when the next text (=sentence, word or even character) is added. So the only color at any time is the last added text.
Anyone has any idea why?

...
richtextbox.text = textbox.text & tt
richtextbox.SelStart = Len(richtextbox.text) - Len(tt)
richtextbox.SelLength = Len(tt)
If forecolor < 15 Then
textbox.SelColor = QBColor(forecolor)
End If


Many thanks,
driesm
 

and yes:
textboxtext should have been RICHtextboxtext in line 1&5
but that's beside the problem.

Driesm
 
If you're setting RTB colour properties you need to use the .TextRTF property rather than the .Text property

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top