Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

http://s1.ipicture.ru/uploads/20120804/bzt2Kk9l.png

 

This code is for richtextbox to add pages.

 

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.

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...