Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I set the highlight color in a Richtextbox ?

Posted on 2010-11-21
2
Medium Priority
?
614 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 2000 total points
ID: 34185741
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
ID: 34213082
Thanks very much Arif - that did the trick.

Patrick
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
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 …
Progress

618 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