本文介绍了程序循环-布尔不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序填写了一个网络表单并提交.问题在于,即使在新加载的页面上,它也会继续提交.我正在使用布尔值尝试阻止程序再次提交,但无法正常工作.有谁知道一种更好的编码方式或一种更好的方式使其停止提交?谢谢你.

My program fills out a web form and submits it. The problem is that it keeps submitting even on the newly loaded page. I was using a Boolean to try to stop the program from submitting again but it''s not working. Does anyone know a better way to code this or a better way to get it to stop submitting? Thank You.

Public Class Form1

    Dim firstSubmit As Boolean = True
    Dim firstButton As Boolean = True
    Dim firstImage As Boolean = True

theElementCollection = WebBrowser1.Document.GetElementsByTagName("input")

        If firstSubmit = True Then
        ElseIf firstButton = True Then
        ElseIf firstImage = True Then
            For Each curElement As HtmlElement In theElementCollection
                If curElement.GetAttribute("name").Equals("button") Then
                    curElement.InvokeMember("click")
                ElseIf curElement.GetAttribute("type").Equals("image") Then
                    curElement.InvokeMember("click")
                ElseIf curElement.GetAttribute("type").Equals("submit") Then
                    curElement.InvokeMember("click")


                    firstSubmit = False
                    firstButton = False
                    firstImage = False

推荐答案



这篇关于程序循环-布尔不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 06:57
查看更多