Remove google cache pages from richtextbox in b.net

Polas5

Member
Joined
Jul 23, 2011
Messages
14
Location
Alytus, Lithuania
Programming Experience
Beginner
VB.NET:
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
                RichTextBox1.AppendText(ch.GetAttribute("href") & vbCrLf)
                If Not ch.GetAttribute("href").Contains("google") And ch.GetAttribute("href").Contains("http") Then
                    RichTextBox1.AppendText(ch.GetAttribute("href") & vbCrLf)
                End If
            Next
        Next
End Sub

I have try not to add google cache pages using this method but no lucky.

VB.NET:
For Each ch As HtmlElement In chld
                RichTextBox1.AppendText(ch.GetAttribute("href") & vbCrLf)
                If Not ch.GetAttribute("href").Contains("google") And ch.GetAttribute("href").Contains("http") Then
                    RichTextBox1.AppendText(ch.GetAttribute("href") & vbCrLf)
                End If
            Next
        Next

I hope someone will know that how to fix this small problem.
Thanks.
 
How about:
If url.StartsWith("http://webcache.googleusercontent.com") Then
 
Can you finish the code you gave cuz it can't find url what it means i have tried to fix the problem with url and tried to change it to mine and i get error or this syntax is already exesiting.
Can yuo finish by my code ?
Thanks.
 
Back
Top