title: Finding the text and highlighting the same with in IHtmlElement in webbrowser control
body: <p>I have to implement the TTS functonality to read out the web page opened in webbrowser control, while the reading the the text also i have to highlighting the work the system is reading but i am unable to do same. 
  I view post here but not get the actual output as i want. and also when i am trying thie below code i am getting the error "System.Runtime.InteropServices.COMException was unhandled
    Message=Exception from HRESULT: 0x800A025E" on the trg.select()</p>
  
  <pre><code>IHTMLDocument2 currentDoc = (IHTMLDocument2)webBrowser1.Document.DomDocument;
  
                  foreach (IHTMLElement elem in currentDoc.body.all)
                  {
  
  
  
                              string[] splitSentences = elem.innerText.Split(" ".ToCharArray());
  
                              for (int i = 0; i &lt; splitSentences.Length; i++)
                              {
  
                                  // highlight(splitSentences[i]);
  
                                  mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)(webBrowser1.Document.DomDocument);
  
                                  IHTMLBodyElement bodyElement = doc.body as IHTMLBodyElement;
  
                                  IHTMLTxtRange trg = bodyElement.createTextRange();
  
  
                                  if (trg.findText(splitSentences[i], 0, 0))
                                  {
                                      trg.select();
                                  }
  
                                  //if (trg != null)
                                  //{
                                  //    String SearchString = splitSentences[i];// "Privacy"; // This is the search string you're looking for.
                                  //    int wordStartOffset = 0; // This is the starting position in the HTML where the word you're looking for starts at.
                                  //    int wordEndOffset = SearchString.Length;
                                  //    trg.move("character", wordStartOffset);
                                  //    trg.moveEnd("character", wordEndOffset);
  
                                  //    trg.select();
                                  //}
  
  
                                  //mshtml.IHTMLSelectionObject sel = (mshtml.IHTMLSelectionObject)doc.selection;
  
                                  //mshtml.IHTMLTxtRange rng = (mshtml.IHTMLTxtRange)sel.createRange();
                                  //// rng.collapse(false);
                                  //if (rng.findText(splitSentences[i], 1000000, 0))
                                  //{
                                  //    rng.select();
                                  //    sound_object.Speak(splitSentences[i], SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync);
                                  //}
                                  //sound_object.Speak(splitSentences[i], SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync);
  
  
                      }
                      Thread.Sleep(2000);
                  }
  </code></pre>
  
  <p>i know this code is not about to find the text with in an element, this will find the text with in whole page i want just figure out hows will it work but it is not working,</p>
  
  <p>Please suggest something usefull. </p>