|
-
May 24th, 2000, 03:04 AM
#1
Thread Starter
Hyperactive Member
I think i must be an idiot. I have a richtextbox control, and my program first receives a color, and then the text. is there a way that I can add this to the front of the text that already exists in the box, have the text be the new color, and have the old text retain its old color and properties?
Cheers
Bill Rogers
-
May 24th, 2000, 03:16 AM
#2
Whenever you recieve the new colour, make sure that the cursor is at the end of the RichTextBox.
Code:
RichTextBox1.SelStart = Len(RichTextBox1.Text)
-
May 24th, 2000, 08:23 PM
#3
Thread Starter
Hyperactive Member
Does anyone here know how when someone adds text to richtextbox, you can not keep the original text coloring?
Here is an example of what I mean
Code:
Private Sub Command1_Click()
Dim x As Integer
If (color) Then
rtb.SelStart = 0
rtb.SelLength = Len(rtb.Text)
rtb.SelColor = vbRed
End If
MsgBox rtb.SelStart
If (color) Then
x = Len(rtb.Text)
rtb.Text = rtb.Text & " Yahoo "
rtb.SelStart = x
rtb.SelLength = 7
rtb.SelColor = vbBlue
Else
x = Len(rtb.Text)
rtb.Text = rtb.Text & " Yahoo "
rtb.SelStart = x
rtb.SelLength = 7
rtb.SelColor = vbGreen
End If
color = False
End Sub
Private Sub Form_Load()
color = True
End Sub
So when I click the command once, it colors the beginning text of the rtb to red, then it adds the word yahoo and colors it blue. But when I click it again, it adds the old text and covers the it all red, then it adds the second yahoo and colors it green. But I lost the original color of blue on the first yahoo.
[Edited by billrogers on 05-25-2000 at 09:26 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|