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
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:
Dim objHtmlDocument As mshtml.HTMLDocument
Dim objRange As mshtml.IHTMLTxtRange
Try
objHtmlDocument = CType(Me.wbrContent.Document, mshtml.HTMLDocument)
objRange = objHtmlDocument.selection.createRange
If objRange.htmlText.Trim = String.Empty Then
...
Else
MsgBox(objRange.htmlText.Trim)
End If
Catch ex As Exception
Finally
objRange = Nothing
objHtmlDocument = Nothing
End Try