Solved

How can I set the highlight color in a Richtextbox ?

Posted on 2010-11-21
2
603 Views
Last Modified: 2012-05-10
How can I set the highlight color in a Richtextbox ?

I would like to be to highlight identical words in a Richtextbox - just as you can in the VS editor.

TIA Patrick using VB 2010
0
Comment
Question by:patrick_otter
2 Comments
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 500 total points
Comment Utility
Looks like you need something like this
if one puts the cursor (clicks mouse) on a word in RTB the same word in the entire content should get highlighted. If thats what you want you can get the word under the cursor and use the function in the code here
http://support.microsoft.com/kb/154884
and instead of the line
rtb.SelColor = lColor
Use
rtb.SelectionBackColor = lColor
this will give you real highlight effect.
0
 

Author Closing Comment

by:patrick_otter
Comment Utility
Thanks very much Arif - that did the trick.

Patrick
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now