Question Search for Highlighted text in RTB (1 Viewer)

byTimber

Registered User.
Local time
Today, 10:51
Joined
Apr 14, 2012
Messages
97
Is there a way of searching a rich text box for any text which is highlighted and then deleting that text? I cannot find an answer to this anywhere..
 

kipcliff

Registered User.
Local time
Today, 12:51
Joined
Sep 19, 2012
Messages
71
In short, put a button on your form and cancel the wizard. Write code in the button's click event to copy the rich text box to a string variable. It copies as plain text with HTML tags.

e.g.
<div>Everything <font style="BACKGROUND-COLOR:#FF0000">and </font><font
style="BACKGROUND-COLOR:#FFFF00">nothing</font>, but <font
style="BACKGROUND-COLOR:#00FFFF">I suppose </font>all will be well.</div>

Then use string functions to parse out the highlighted portions and return the rest to the textbox.

N.B. There is a 255 char limit to strings. A little extra work will be required to manage text beyond that range. Perhaps a plaintext box bound to the same source, hidden on your form, that your code can crawl through.
 
Last edited:

byTimber

Registered User.
Local time
Today, 10:51
Joined
Apr 14, 2012
Messages
97
Thanks kipcliff that's helpful....
 

Users who are viewing this thread

Top Bottom