Wednesday, April 10, 2013

GetElementsByTagName VB.NET Tutorial

You can easily get code within tags by using this very simple code.


Dim PageElements3 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input") 
            For Each CurElement As HtmlElement In PageElements3
                If CurElement.GetAttribute("id") = "strFirstName" Then
                    WebBrowser1.Document.GetElementById("strFirstName").Focus()
                    CurElement.InnerText = datastringbefore(0)
       End If
Next

Where input = the tag you want to search for
     and
Where id = the attribute of the tagname you are searching for

Hope you guys enjoyed this quick tutorial.

No comments:

Post a Comment