Vba 事件是否返回到子项的顶部?
每当它点击application.doevents()时,它就会返回到子对象的开头,为什么要这样做?我怎么修理它Vba 事件是否返回到子项的顶部?,vba,Vba,每当它点击application.doevents()时,它就会返回到子对象的开头,为什么要这样做?我怎么修理它 第一个_time变量以true开头,因此第一个if语句被运行。我在程序的其他部分有这段代码,也有它自己的子代码,它只发生在这个地方,为什么它会这样做?我想你的计时器滴答事件正在工作。您必须在它第一次滴答声后启用它 在代码的第一行添加:timer1.enabled=false,但我需要它每秒循环一次,所以不要执行事件。或者为每个计时器勾选一个线程。第二个选择我不知道怎么做,但那就是方法
第一个_time变量以true开头,因此第一个if语句被运行。我在程序的其他部分有这段代码,也有它自己的子代码,它只发生在这个地方,为什么它会这样做?我想你的计时器滴答事件正在工作。您必须在它第一次滴答声后启用它
在代码的第一行添加:
timer1.enabled=false
,但我需要它每秒循环一次,所以不要执行事件。或者为每个计时器勾选一个线程。第二个选择我不知道怎么做,但那就是方法
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim webstring As String
Dim webarray() As String
If first_time = True Then
Dim randomValue1 As Integer = CInt(Math.Floor((2 - 1 + 1) * Rnd())) + 1
Dim randomValue2 As Integer = CInt(Math.Floor((4 - 3 + 1) * Rnd())) + 3
Dim randomValue3 As Integer = CInt(Math.Floor((6 - 5 + 1) * Rnd())) + 5
Dim randomValue4 As Integer = CInt(Math.Floor((8 - 7 + 1) * Rnd())) + 7
Dim randomValue5 As Integer = CInt(Math.Floor((10 - 9 + 1) * Rnd())) + 9
Dim randomValue6 As Integer = CInt(Math.Floor((10 - 1 + 1) * Rnd())) + 1
If randomValue6 = randomValue1 Or randomValue6 = randomValue2 Or randomValue6 = randomValue3 Or randomValue6 = randomValue4 Or randomValue6 = randomValue5 Then
randomValue6 = CInt(Math.Floor((10 - 1 + 1) * Rnd())) + 1
End If
wb.Navigate(New Uri("http://direct.notaurl.org/games/index.php?sub=29&id=11393&ticket=" & randomValue6))
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate(New Uri("http://direct.notaurl.org/games/index.php?sub=57"))
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
webstring = wb.DocumentText.ToString()
webarray = Split(webstring, ";")
item_id = webarray(0)
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue1)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue2)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue3)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue4)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue5)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
first_time = False
End If
wb.Navigate("http://notaurl.org/games/index.php?sub=57&fieldid=" & item_id)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
webstring = wb.DocumentText.ToString()
webarray = Split(webstring, ";")
If webarray(0) = "WIN" Then
Dim randomValue1 As Integer = CInt(Math.Floor((2 - 1 + 1) * Rnd())) + 1
Dim randomValue2 As Integer = CInt(Math.Floor((4 - 3 + 1) * Rnd())) + 3
Dim randomValue3 As Integer = CInt(Math.Floor((6 - 5 + 1) * Rnd())) + 5
Dim randomValue4 As Integer = CInt(Math.Floor((8 - 7 + 1) * Rnd())) + 7
Dim randomValue5 As Integer = CInt(Math.Floor((10 - 9 + 1) * Rnd())) + 9
Dim randomValue6 As Integer = CInt(Math.Floor((10 - 1 + 1) * Rnd())) + 1
If randomValue6 = randomValue1 Or randomValue6 = randomValue2 Or randomValue6 = randomValue3 Or randomValue6 = randomValue4 Or randomValue6 = randomValue5 Then
randomValue6 = CInt(Math.Floor((10 - 1 + 1) * Rnd())) + 1
End If
wb.Navigate(New Uri("http://direct.notaurl.org/games/index.php?sub=29&id=11393&ticket=" & randomValue6))
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate(New Uri("http://direct.notaurl.org/games/index.php?sub=57"))
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
webstring = wb.DocumentText.ToString()
webarray = Split(webstring, ";")
item_id = webarray(0)
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue1)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue2)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue3)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue4)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.Navigate("http://notaurl.org/games/index.php?sub=32&id=" & item_id & "&ticket=" & randomValue5)
Do Until wb.ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
End If
End Sub