title: Retrieve Selected Text from a Web Browser Control in a
body: <p>Here's what I am trying to do:</p>
  
  <p>Select text from a webpage I pulled up using my web browser control.After clicking a button while this text is still selected I would like a message box to pop-up displaying the text that was highlighted by the user. How do I get this functionality to work in my wpf application?</p>
  
  <p>I think I'm on the right track using mshtml but I get an error that says:</p>
  
  <blockquote>
    <p>Error HRESULT E_FAIL has been returned from a call to a COM component.</p>
  </blockquote>
  
  <p>This error will happen even when I try something small on the document like changing the title.</p>
  
  <p>The code is below:</p>
  
  <pre><code>IHTMLDocument2 doc = (IHTMLDocument2)this.webBookText.Document;
  doc.title = "l";
  </code></pre>