how remove these google junk pages from richtextbox and fix listbox vb.net ?

polas

Newcomer
Joined
Aug 4, 2012
Messages
1
Hi,I'm Polas and i need to someone to help me to fix the problem.
The problem is how remove these google junk pages from richtextbox and fix listbox problem ?

Here is the picture to understand what i mean.
bzt2Kk9l.png


This code is for richtextbox to add pages.

Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        Dim htmlele As HtmlElementCollection
        htmlele = WebBrowser1.Document.GetElementsByTagName("h3")
        For Each htm As HtmlElement In htmlele
            Dim chld As HtmlElementCollection = htm.GetElementsByTagName("a")
            For Each ch As HtmlElement In chld
                If ch.GetAttribute("href").Contains("google") And ch.GetAttribute("href").Contains("http") Then
                    RichTextBox1.AppendText(ch.GetAttribute("href") & vbCrLf)
                End If
            Next
        Next
End Sub

This code adds pages from ritchtextbox and seperate and adds only matched pages in listbox but something wrong with richtextbox and with listbox.

The richtextbox pages scrolls good and adds in it all links but with google junk pages and in listbox it adds only some links wwithout google junk page.
So how do i fix this problem ?

do someone knows ?
listbox removes google pages and not add them in list but adds only some of them not all i it should be.

Code:
Dim allelements As HtmlElementCollection = WebBrowser1.Document.Links
        For Each url As HtmlElement In allelements
            If Not url.GetAttribute("href").Contains("google") And url.GetAttribute("href").Contains("http") Then
                lbx.Items.Add(url.GetAttribute("href"))
            End If
 
Back
Top