Oppure

Loading
22/07/11 13:16
nonsonoio
Salve a tutti vi spiego subito quello che vorrei fare:
devo estrarre i dati da una tabella html usando htmlAgility Pack.
Questo e' il mio codice che quando viene eseguito mi da' un errore di riferimento.
Non riesco a capire dove sia l'errore, io piu' di questo non riesco a fare

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim web As New HtmlAgilityPack.HtmlWeb()
        Dim doc As New HtmlAgilityPack.HtmlDocument()
        doc = web.Load("http://www.mia_pagina")
        Dim tables As HtmlAgilityPack.HtmlNodeCollection
        tables = doc.DocumentNode.SelectNodes("//TABLE")
        Dim rows As HtmlAgilityPack.HtmlNodeCollection
        rows = tables(0).SelectNodes("./tr")
        For i As Integer = 0 To rows.Count - 1
            'Iterare all columns in this row
            Dim cols As HtmlAgilityPack.HtmlNodeCollection = rows(i).SelectNodes("./td")
            For j As Integer = 0 To cols.Count - 1
                'get the value of the colum and print
                Dim value As String = cols(j).InnerText
                ListBox1.Items.Add(value)

            Next

        Next

    End Sub
Ultima modifica effettuata da Il Totem 23/07/11 11:11
aaa
23/07/11 11:06
Qwertj
In quale riga è generato l'errore?
aaa