This project has moved. For the latest updates, please go here.

null reference exception

Jul 23, 2011 at 10:18 AM

Hello I explain what I would do immediately:
I have to extract data from a table using html htmlAgility Pack
This 'my code that when executed gives me' a reference error.
I can not figure out what is wrong, I am more 'I can not do this

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 



End Sub