我在 Visual Basic 中有一个脚本,我似乎无法让它重复/循环。我希望脚本在单击给定变量后重复,然后刷新页面。然后页面刷新并且刻度为 0,但我希望脚本再次重复(无限)。这是我正在处理的脚本:
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
If Not number_of_ticks > 100 Then
number_of_ticks += 1
WebBrowser1.Document.GetElementById("claimIt").InvokeMember("Click")
Else
'number_of_ticks has exceed the maximum amount of allowed ticks
Timer1.Enabled = False
WebBrowser1.Refresh()
number_of_ticks = 0
End If
End Sub
但是当我尝试做一个循环时,它不起作用,程序变得无响应:
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
Do
If Not number_of_ticks > 100 Then
number_of_ticks += 1
WebBrowser1.Document.GetElementById("claimIt").InvokeMember("Click")
Else
'number_of_ticks has exceed the maximum amount of allowed ticks
Timer1.Enabled = False
WebBrowser1.Refresh()
number_of_ticks = 0
End If
Loop
End Sub
我不知道为什么会发生这种情况,有什么帮助吗?