Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Dear Friends,
Good morning to all...
 
I will be very thankful to u ,if u give solution for the below question
 
I am developing window application to edit pdf content.for example I have one textbox field for getting keyword and one richtextbox field for getting paragaph.
 
if the keyword(ie.,value of textbox) exist in paragraph,we need to highlight the text in paragraph field(ie.,richtextbox).any suggestion for this?
Posted 22-Feb-13 19:03pm
jai_mca1.1K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
jai_mca at 23-Feb-13 2:20am
   
thanks a lot Uma..i have one doubt.after the text got selected with color,when we double click it the sentence which the word exist need to load in another rtb box.is it possible?which event used for that?
Uma Shankar Patel at 23-Feb-13 2:29am
   
http://stackoverflow.com//questions/10746121/richtextbox-select-line-on-click
 
try this
jai_mca at 23-Feb-13 4:07am
   
i just wanted to select the sentence when i double click highlighted text in rich text box.how can i do in double click event??
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi.Try This Method.If you are working with WPF.
 

 
and your code behind:
 
private void MainRichTextBox_SelectionChanged(object sender, RoutedEventArgs e)
{
RichTextBox richTextBox = e.OriginalSource as RichTextBox;
richTextBox.SelectionBrush = Brushes.Yellow;
 
//for access to your RichTextBox content
TextRange textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
if (textRange.Text.Contains("TextBox"))
{
//Put your policy code here for changing Foreground color
}
}
I hope this help you.
Good Luck
  Permalink  
v2
Comments
jai_mca at 23-Feb-13 2:19am
   
thanks ali..i have one doubt.after the text got selected with color,when we double click it the sentence which the word exist need to load in another rtb box.is it possible?which event used for that?
ali rad at 23-Feb-13 2:53am
   
you're welcome.but can you obvious your question?
jai_mca at 23-Feb-13 2:56am
   
i just wanted to select the sentence when i double click highlighted text in rich text box.how can i do ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.141022.2 | Last Updated 23 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100