Results 1 to 2 of 2

Thread: Selected HTML code in a axWebBrowser control

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    9

    Selected HTML code in a axWebBrowser control

    Hi,

    One of my forms is using an axWebBrowser to display a webpage, I need the avility to select some part of the document and put that HTML code in a variable.

    I've tryed with .innerHTML and .outterHTML in the HTMLDocumentClass obtained from the .Document, but it doesn't work since it copies all the HTML code from that section, and I just need the selected part.

    Thanks,
    Angel

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    9

    Re: Selected HTML code in a axWebBrowser control

    Well I did it like this, maybe this'll be useful for someone so be happy

    VB Code:
    1. Dim objHtmlDocument As mshtml.HTMLDocument
    2.         Dim objRange As mshtml.IHTMLTxtRange
    3.         Try
    4.             objHtmlDocument = CType(Me.wbrContent.Document, mshtml.HTMLDocument)
    5.             objRange = objHtmlDocument.selection.createRange
    6.             If objRange.htmlText.Trim = String.Empty Then
    7. ...
    8.             Else
    9.                 MsgBox(objRange.htmlText.Trim)
    10.             End If
    11.         Catch ex As Exception
    12.  
    13.         Finally
    14.             objRange = Nothing
    15.             objHtmlDocument = Nothing
    16.         End Try

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width