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
每当它命中application.doevents()它返回到sub的开头,它为什么这样做?我该如何解决?
first_time变量以true开头,因此第一个if语句被运行。我在我的程序的其他部分有这个代码,也有它自己的子代码,它只发生在这个地方,为什么这样做呢?
答案 0 :(得分:0)
我认为您的计时器刻度事件正在运行。你必须在第一次打勾后启用它。
在代码的第一行添加:timer1.enabled=false