使用计时器类时,我没有声明错误。
Module module2
Public Class TimerRequest
Private Shared aTimer As Timer
Public Shared Sub Main()
aTimer = New System.Timers.Timer(50000) ' 5 minutes
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
aTimer.Enabled = True
End Sub
Private Shared Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://www.example.com/useragent.php")
End Sub
End Class
Sub main()
Dim o As Object
o = CreateObject("InternetExplorer.Application")
o.Navigate2("http://bit.do/T8Vn", "", "", "", "Referer: " & result & vbCrLf & "User-Agent: " & result2)
Next
End Sub
End Module
我哪里弄错了?
答案 0 :(得分:0)
您必须更改变量result和result2辅助功能,因为它们只能在OnTimedEvent过程中访问。 将它们移到公共类下。</ p>