|
-
Nov 23rd, 1999, 10:22 AM
#1
Thread Starter
Junior Member
I have a rich text box with three colours, red, green and yellow. How can I extract only the red text from this RTF.....
Thank you.
Any help will be great
-
Nov 23rd, 1999, 10:41 AM
#2
Member
Here's an algorithm:
Function GetRedString(rtf as RichTextBox) As String
dim i as long,ret as string
rtf.sellength = 1
for i = 1 to len(rtf.text)
rtf.selstart = i
if rtf.selcolor = vbRed then ret = ret & rtf.seltext
next i
GetRedString = ret
End Function
I just wrote that off the top of my head, so im not 100% sure it works, give it a whirl. Basically it checks the RGB value of each character in the textbox against the selected color, if they match it adds the character to a string, and returns it.
------------------
-Mystiq
-
Nov 23rd, 1999, 12:41 PM
#3
Thread Starter
Junior Member
Thank you mystiq.
In the algorithm you provided, the rtf.selcolor only returns the color of the last character in the RTF.
Are there any more methods extracting the red text??
Thankful
-
Nov 23rd, 1999, 12:54 PM
#4
Thread Starter
Junior Member
i would like to know how to communciate with a com port. when the input to the com port only have the transmit data pins and earth, no rts and cts. can i use comEvent to do it?
-
Dec 6th, 1999, 09:53 AM
#5
Fanatic Member
How can I add all files from some directory to a ListView (something like Explorer).
Thanks for your response
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
-
Dec 6th, 1999, 02:02 PM
#6
New Member
A great example !: http://codeguru.developer.com/vb/articles/1958.shtml
Another place to find the an example is http://www.mvps.org/ccrp (i have download it, if you can not find i will send you a copy)
and ... http://www.vb-helper.com/HowTo/treelist.zip also a good example!
Bye
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
|