How to copy text from webbrowser/Frame Control (WPF)

C

claton

Hello,

I've added a webbroswer control in my WPF application, As the app loads up,
it naviagates to a site then How do I copy text from the site using code. I
can successfully do this in WinForms using WebBrowser1.Document.DomDocument
not able to do the same in WPF webbrowser control.
Any tips.

Thanks in Advance!

Regards,
Claton
 
C

claton

Thank you Bjarte for replying,
I have checked the msdn and the property document is a bit different than
the WinForm WebBrowser. I have the following code in Winform

Public Class Form1
Dim doc As mshtml.HTMLDocument
Dim txtRange As mshtml.IHTMLTxtRange
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("www.microsoft.com")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
txtRange = doc.selection.createRange()
MessageBox.Show(txtRange.text.ToString())
End Sub

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal
e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles
WebBrowser1.DocumentCompleted
doc = Me.WebBrowser1.Document.DomDocument
End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top