|
-
Feb 14th, 2000, 12:59 PM
#1
Thread Starter
Addicted Member
ok here what i want to do like if there a word in the rtf Called Port I want the word port to be Blue and other words can someone in here please help me with this?
-
Feb 15th, 2000, 03:37 PM
#2
Conquistador
i have already answered this question, try searching next time 
anyway, here it is for you
Code:
RichTextBox1.Text = "Port: LPT1" 'Whatever the text is
RichTextBox1.SelStart = 0 'Where the other text before port ends
RichTextBox1.SelLength = 4 'the length of "Port"
RichTextBox1.SelColor = vbBlue 'Set the color of selected text
RichTextBox1.SelStart = Len(RichTextBox1.Text) 'Goto end of text box
------------------
david
Teenage Programmer
-
Feb 16th, 2000, 07:14 AM
#3
Thread Starter
Addicted Member
hey what do i use this code in it not working in the change code thing
RichTextBox1.Text = "Port: LPT1" 'Whatever the text is
Code:
RichTextBox1.SelStart = 0 'Where the other text before port ends
RichTextBox1.SelLength = 4 'the length of "Port"
RichTextBox1.SelColor = vbBlue 'Set the color of selected text
RichTextBox1.SelStart = Len(RichTextBox1.Text) 'Goto end of text box
-
Feb 16th, 2000, 07:28 AM
#4
You can use this function I wrote:
Code:
Public Sub ColorWords(pRich As RichTextBox, pWord As String, pColor As OLE_COLOR)
Dim iPos As Integer
With pRich
iPos = InStr(iPos + 1, .Text, pWord, vbTextCompare)
Do While iPos <> 0
.SelStart = iPos - 1
.SelLength = Len(pWord)
.SelColor = pColor
iPos = InStr(iPos + 1, .Text, pWord, vbTextCompare)
Loop
End With
End Sub
Then call this sub routine like this:
ColorWords RichTextBox1, "Port", vbBlue
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Feb 16th, 2000, 07:44 AM
#5
Thread Starter
Addicted Member
Thanx Man That Otehr GuyDid Not Help Me With Crap You Help Alot It was Just What I Was Looking For
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
|