Webbrowser getelementbytagname
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts
Page 1 of 1
I have a webbrowser i want to items from the part of the website which has the tagline tr, but thare are 5 tr at every string so i want the first tr in that single string to be the main item in a listsview and then the 4 as subitems
see my picture for an example, and i want to do it with the whole list
This is the website im trying to do it from
http://proxy-ip-list.com/
see my picture for an example, and i want to do it with the whole list

This is the website im trying to do it from
http://proxy-ip-list.com/
You can use this:
Code: Select all
Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
ListView1.Items.Clear()
Dim table As HtmlElement = WebBrowser1.Document.GetElementsByTagName("tbody")(0)
Dim rows As HtmlElementCollection = table.GetElementsByTagName("tr")
For i As Integer = 0 To rows.Count - 1
Dim lvi As ListViewItem = New ListViewItem()
Dim columns As HtmlElementCollection = rows(i).GetElementsByTagName("td")
For i2 As Integer = 0 To columns.Count - 1
If i2 = 0 Then
lvi.Text = columns(i2).InnerText
Else
lvi.SubItems.Add(columns(i2).InnerText)
End If
Next
ListView1.Items.Add(lvi)
Next
End Sub
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023