Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlight text in RichText Control

Status
Not open for further replies.

Baudi

Technical User
May 20, 2002
5
BE
I need to have a Word-like marker in a RichText box...
I know of course how to set the color of selected text itself; but I don't see how to really highlight that selected text.
When I highlight text in Word (with the highlight tool), and then copy and paste the whole text into a RichText box control in Access 2000, the highlighted words remain highlighted.
Looking at the RTF-code itself, I see that when highlighted text is pasted from Word into a Richtext control, one line of code is added in the beginning of the whole text (right after the first line of "RTF-codes"), defining the use of colors for highlighting:

{\colortbl ;\red0\green0\blue255;\red0\green255\blue255;\red255\green0\blue0;}

When text is highlighted, it is surrounded in rtf by tags (f.i.: \highlight2 and at the end by \highlight0). So, I guess it must be possible to highlight text within a Richtext box control with VB code, isn't ?

If someone finds the answer, it would help me really !
 
hi,


use selstart and sellength properties


starting position of selected text


richtext1.selsatart = 0


ending position of selected text


richtext1.sellength = richtext1.text


the code will select all of the text in a Rich text box.


Also pay attention to "HideSelection"


Bye


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top