47. Get Elements By Tag Name
In a previous tutorial, we covered how to interact with HTML elements using the ID of that element. This tutorial will show you how to interact with HTML elements depending on the tag name. If you did not understand HTML elements in the previous tutorial, there is a better explanation here for you.
Code
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate(TextBox1.Text) End Sub Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Dim PageElements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("img") For Each CurElement As HtmlElement In PageElements TextBox2.Text = TextBox2.Text & CurElement.GetAttribute("src") & Environment.NewLine Next End Sub End Class

