Here in this vb.net application I have added a simple html file contains a table with few records to show you how it works.
Code: How to grab website table data into listview control in vb.net
Dim k As Integer Dim p As Integer ListView1.Items.Clear() Dim X As ListViewItem Dim outputstream1 As String Dim outputstream2 As String k = WebBrowser1.Document.GetElementsByTagName("tr").Count Dim tRow As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("tr") p = 0 While (p <= k - 1) Dim pp As HtmlElementCollection = tRow.Item(p).GetElementsByTagName("td") 'Because table has only 2 columns so no need to pass pp item index dynamically outputstream1 = pp.Item(0).InnerText outputstream2 = pp.Item(1).InnerText X = New ListViewItem(outputstream1) X.SubItems.Add(outputstream2) ListView1.Items.Add(X) p = p + 1 End While 'Following line will remove table header ListView1.Items.RemoveAt(0)
It is really easy to understand and useful to grab simple table data from website and this program can be easily modified to suit your need. You can download the complete source code here.