Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

How to extract data from a HTML table?

$
0
0
I recently downloaded HtmlAgilityPack but I haven't found any real instructions on how to use it. I have attempted to piece together some code based on some various discussion board posts and other sources. Here is what I have so far:

Code:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim document As New HtmlAgilityPack.HtmlDocument
        document.LoadHtml("www.reuters.com/finance/stocks/overview?symbol=GOOG")

        Dim tabletag = document.DocumentNode.SelectSingleNode("//table[@class='data']/tr[1]/td[2]")
    End Sub

As you can see I am working with the HTML from http://www.reuters.com/finance/stock...ew?symbol=GOOG. I am trying to extract the Beta value from this page. This value is currently 1.04.

When I run the code above my immediate window shows this repeated 100 times:
Quote:

1.04
$243,156.41
328.59
--
--
Trading Report for (GOOG). A detailed report, including free correlated market analysis, and updates.
ValuEngine Detailed Valuation Report for GOOG
GOOGLE INC CL A (GOOG) 12-months forecast
GOOGLE INC CL A (GOOG) 2-weeks forecast
Google Inc: Business description, financial summary, 3yr and interim financials, key statistics/ratios and historical ratio analysis.
I only want the first line returned. What am I doing wrong? Any suggestions?

Thank you very much!

Viewing all articles
Browse latest Browse all 27514

Trending Articles