Ses Manijak Ses Manijak - 4 years ago 201 Question

VB.Net Copy all text from WebBrowser

I want to copy all visible text from WebBrowser.


This code is working, but it's also getting text between
<div style="display:none">
, which i don't want (i want only text that is visible when i manually go to that website).

Answer Source

This works for me against This is mostly a translation of the c# version of the same question mentioned in the comments above.

    Dim text As String
    WebBrowser1.Document.ExecCommand("SelectAll", False, Nothing)
    WebBrowser1.Document.ExecCommand("Copy", False, Nothing)
    text = Clipboard.GetText()
    MessageBox.Show(text, "Text")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download