I have this code.

I need to loop through it, until button 2 is pressed.

I also want to count how many times its looped and show how many times in a label.

Public Class Form1


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Function GetPromotionElements() As HtmlElement()
        Dim inputElements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
        Dim promotionElements As New List(Of HtmlElement)()

        For Each element As HtmlElement In inputElements
            Dim type As String = element.GetAttribute("type")
            Dim name As String = element.GetAttribute("name")

            If Not String.IsNullOrEmpty(type) AndAlso type = "checkbox" Then
                If Not String.IsNullOrEmpty(name) AndAlso name = "anonymous" Then
                End If
            End If
        Return promotionElements.ToArray()
    End Function

    Private Sub tickbox()
        Dim promotionElements() As HtmlElement = GetPromotionElements()

        For Each element As HtmlElement In promotionElements

            element.SetAttribute("checked", "false")

    End Sub

    Private Sub Submit()
        Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("button")
        For Each curElement As HtmlElement In theElementCollection
            Dim controlName As String = curElement.GetAttribute("name").ToString
            controlName = "Submit"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub

End Class

Can anyone help me? Loop button1.

You need to be more specific.

You have 3 procedures with For statements.

Explain a little more and it will get answered.

This article has been dead for over six months. Start a new discussion instead.