Here is my code so far:
There are multiple "TD" tagnames in the webpage im working with. My code looks at all of them and checks if they contain "testWord".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") Else MsgBox("not found") End If End If Next
What I need is some way of saying:
If ANY text.Contains("testWord") Then
MsgBox("found")
Else
MsgBox("not found")
Or
If THE 8th text.Contains("testWord") Then
MsgBox("found")
Else
MsgBox("not found")
Currently im getting 20 msgBox's telling me "found" and "not found". I just want one.




Reply With Quote