• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

I need to retrieve text from the from the 16th table on a website

I'm trying to retrieve text on a website. The text I need to retrieve is on the 16th table, 3rd <TR>, 1st <TD>
I need all the text on that TD. It isn't much, maybe 10 digits. I've managed to figure out:

txtStats.Text = WebBrowser1.Document.getElementsByTagName("table").Item(15).children.Item(0).innertext

But this returns the all the text on that entire <TR> (including the 2nd and 3rd <TD>s). I would normally just mid out what I need but the length of the text in the fields change from time to time and there is no "anchor" from which to base the instr off of.  The table is nested within another table. I'm not sure how many tables deep its nested into. This the table in question:

<table width="249" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td colspan="5"><img src="a.gif" width="249" height="21"></td>
                          </tr>
                          <tr>
                            <td colspan="5"><img src="a.gif" width="1" height="1"></td>
                          </tr>
                          <tr align="left">
                            <td width="85" height="21" bgcolor="#1C9FEC"><font color="#ffffff" face="tahoma" style="font-size: 12px"><img src="a.gif" width="5" height="1">THIS IS THE TEXT I NEED TO RETRIEVE</font></td>
                            <td width="1"><img src="a.gif" width="1" height="1"></td>
                            <td width="80" bgcolor="#1C9FEC"><font color="#ffffff" face="tahoma" style="font-size: 12px"><img src="a.gif" width="5" height="1">Some text</font></td>
                            <td width="1"><img src="a.gif" width="1" height="1"></td>
                            <td width="82" bgcolor="#1C9FEC"><font color="#ffffff" face="tahoma" style="font-size: 12px"><img src="a.gif" width="5" height="1">Some text</font></td>
                          </tr>
                        </table>

Thanks a bunch
0
JohnDoeSr
Asked:
JohnDoeSr
1 Solution
 
paulgrunnerCommented:
txtStats.Text = WebBrowser1.Document.getElementsByTagName("table").Item(15).rows(2).cells(0).innertext
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now