Re: Multiple "TD" tagNames
Then exit the loop as soon as you fine the first one.
Code:
Dim htmlDoc As HtmlDocument = Me.WebBrowser1.Document
Dim visibleHtmlElements As HtmlElementCollection = htmlDoc.GetElementsByTagName("TD")
For Each str As HtmlElement In visibleHtmlElements
If Not str.InnerText Is Nothing Then
Dim text As String = str.InnerText
If text.Contains("testWord") Then
MsgBox("found")
Exit For
Else
MsgBox("not found")
Exit For
End If
End If
Next
Re: Multiple "TD" tagNames
If you're really finding 20 of them, are they all returning the same? You mention any or the 8th innertext. Will the first one found suffice, if so look above, otherwise, just keep a count for each one found, then when the count is 8, after it finds that msgbox you can exit the for loop.
Re: Multiple "TD" tagNames
Since you're in a VB.NET forum, I will also suggest that you use MessageBox.Show() instead of MsgBox().
Strange how many people still even know of MsgBox().