Solved

Getting DIV's with the ID = class='matches' USING HtmlAgilityPack

Posted on 2014-01-30
2
602 Views
Last Modified: 2014-01-30
Anyone able to provide any help on what im missing after the For Each link As HtmlNode In node

	Dim hw As New HtmlWeb()
Dim doc As HtmlDocument = hw.Load("http://www.livefutbol24.com/Football/Live")
	Dim node As HtmlNode = doc.DocumentNode.SelectSingleNode("//div[@class='matches']")
For Each link As HtmlNode In node
	lblHTMLOutput.Text += link.InnerHtml
Next

Open in new window

0
Comment
Question by:runnerjp2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Ken Butters earned 500 total points
ID: 39820823
What are you trying to do?    

Is there more than one DIV with class='matches' that you are trying to process?

In order for you to loop through a list of nodes you have to have some sort of array to loop through.   As it stands right now, you only have a single node as a result of "selectSingleNode".

If you had used "selectNodes" instead of "selectSingleNode" the result would have been an array of nodes that you could loop through.
0
 

Author Closing Comment

by:runnerjp2005
ID: 39820937
This is what i did in the end


Dim webGet As New HtmlWeb() 'open the system
        Dim htmlDoc As HtmlDocument = webGet.Load("http://www.livefutbol24.com/Football/Live")'' get the html from the webpage

     

            For Each div As Object In htmlDoc.DocumentNode.SelectNodes("//td[@class='score']")' select all the divs within the code that contain *

            lblHTMLOutput.Text += div.InnerText & "<br>"

        Next
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Check only one toolstripmenu item 12 63
Adjust the codes 3 65
Datagridview column resizing 8 28
Manage big list of parameter list 8 27
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question