Click to See Complete Forum and Search --> : Help with Rich text box
clonE
Jan 14th, 2000, 08:40 AM
I have searched and read previous posts regarding similar topics, but none seemed to help. What I want to do is have something sort of like how america online has their richtext box, where the names of the people typing are a certian color but the text they type is just black. What I have set up is a text box(txtEdit), and in the keydown event, i have it so when enter or chr(13) is detected, it sends text to the RTB. I want it to do someting like this:
txtView.text = textView.text & (start of the color) UserName & ":" (end of color) & txtEdit.text
(UserName is the persons handle, say "Mike". where txtEdit is the textbox they type into, and txtView is the RTB is shows up in)
does anyone have any idea how I would do this? any help at all would be greatly appreciated.
ianpaisley
Jan 14th, 2000, 06:32 PM
I don't know if this will be much use, but I saw an article on colour coding and such stuff at:
http://www.vb-world.net/tips/tip148.html
P.S: Does anyone know I can put a piece of text in a message on this board so it is a hyperlink (like the text above)?
ianpaisley
Jan 14th, 2000, 06:34 PM
No need to tell me! I've just discovered it does it automatically.
clonE
Jan 15th, 2000, 11:09 AM
thanks, but the:
previouscolor=rtfbox1.selcolor
rtbox1.textrtf = left ( rtbox1.textrtf,len(rtbox1.textrtf)- len("MIKE"))
rtbox1.selcolor = VBBlue
rtbox1.textrtf = rtbox1.textrtf & "MIKE"
rtbox1.selcolor= previouscolor
that doesnt seem to work, isnt there a way to make html enabled with rtb? that would be alot easier
JorgeLedo
Jan 15th, 2000, 11:13 AM
I believe you can put in the RTB_Change event code that checks if the user name was writen and change the color :
RTBox1.SelColor = VBBlue
How?
By doing suposing the name is "MIKE" (4 char):
previouscolor=rtfbox1.selcolor
rtbox1.textrtf = left ( rtbox1.textrtf,len(rtbox1.textrtf)- len("MIKE"))
rtbox1.selcolor = VBBlue
rtbox1.textrtf = rtbox1.textrtf & "MIKE"
rtbox1.selcolor= previouscolor
I just wrote this piece so if it doesn't work stays the ideia.
------------------
Jorge Ledo
j_ledo@hotmail.com
Portugal
[This message has been edited by JorgeLedo (edited 01-15-2000).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.