How to get only one information from this table? VB.NET

Asked

Viewed 155 times

0

Hello, I have this table, which has no class, id or name. I would like to pick up only her phone.

how would it be possible to take?

<tr>
                    <td><a href="http://www.google.com/">1</a></td>
                    <td><a href="http://www.google.com/"></a></td>
                    <td><a href="http://www.google.com/">name</a></td>
                    <td><a href="http://www.google.com/">99 999999999</a></td>
                    <td><a href="http://www.google.com/">[email protected]</a></td>
                </tr>

2 answers

2


Maybe it’s something like:

Dim TDUM As String
Dim TDDOIS As String
Dim TDTRES As String
Dim TDQUATRO As String
Dim count As Integer = 0

Dim substrings() As String = Regex.Split(codigo.text, "<a[^<>]*>")
    For Each match As String In substrings
                Dim aryTextFile = match.Split("</a>")
                If count = 2 Then
                    TDUM = aryTextFile(0)
                ElseIf count = 3 Then
                    TDDOIS = aryTextFile(0)
                ElseIf count = 4 Then
                    TDTRES = aryTextFile(0)
                ElseIf count = 5 Then
                    TDQUATRO = aryTextFile(0)
                End If
                count += 1
            Next

count = 0

That would be about it, I’m studying, so there are definitely smaller codes out there, but I was able to get to this code at the time.

For people who understand, I’m sorry for the big, messy code (:

0

It is not a good idea an element without identifiers, but assuming that this is the best case. (only table in the DOM, always with this amount of columns) , you can use jQuery:

$('table').find ('td').eq(3);
  • Actually, it would be VB.NET, sorry. I think there was some error.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.