|
-
Nov 5th, 1999, 02:46 PM
#1
Thread Starter
So Unbanned
Want to be able to assign certain words certain colors without having to select it i.e.
these commands
selstart
sellength
i just need to to change automatically like the VB editor
------------------
DiGiTaIErRoR
-
Nov 5th, 1999, 07:03 PM
#2
Guru
Try this: (It does use selection, but it does not look like it is... Try it)
Dim OldSelStart As Long
RichTextBox1.TextRTF = "Hello World" ' Clear formatting and change text to Hello World
OldSelStart = RichTextBox1.SelStart ' Remember old SelStart
' Color the Hello:
RichTextBox1.SelStart = InStr(RichTextBox1.Text, "Hello") - 1
RichTextBox1.SelLength = Len("Hello")
RichTextBox1.SelColor = vbRed
' Color the World:
RichTextBox1.SelStart = InStr(RichTextBox1.Text, "World") - 1
RichTextBox1.SelLength = Len("World")
RichTextBox1.SelColor = vbBlue
' Clear selection:
RichTextBox1.SelStart = OldSelStart
------------------
Yonatan
Teenage Programmer
E-Mail: [email protected]
ICQ: 19552879
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
|