Click to See Complete Forum and Search --> : ListView Q
nick99
Nov 23rd, 1999, 09:22 AM
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
mystiq
Nov 23rd, 1999, 09:41 AM
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
nick99
Nov 23rd, 1999, 11:41 AM
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
nick99
Nov 23rd, 1999, 11:54 AM
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?
QWERTY
Dec 6th, 1999, 08:53 AM
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.
Sigal Laniado
Dec 6th, 1999, 01:02 PM
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.