我使用
成功从网页检索数据Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://example.org")
MsgBox(result)
但是,我需要让它更新,就像每5分钟它应该再次检索数据。应该采用什么样的正确方法?感谢。
答案 0 :(得分:1)
创建一个定时器设置处理程序并在每个间隔
中执行请求Imports System.Timers
Public Class TimerRequest
Private Shared aTimer As Timer
Private Shared o as Object
Public Shared Sub Main()
aTimer = New System.Timers.Timer(300000) ' 5 minutes
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
aTimer.Enabled = True
End Sub
Private Shared Sub OnTimedEvent(source As Object, e As ElapsedEventArgs)
o = CreateObject("InternetExplorer.Application")
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://example.org")
For i As Integer = 0 To 2
//your loop here
Next
End Sub
End Class