VB中TIMER运行一个过程,老是出错!!高分求助!!

来源:百度知道 编辑:UC知道 时间:2024/07/02 04:18:17
代码如下:
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.timedate.cn/worldclock/ti.asp"
End Sub

Private Sub Timer1_Timer()
Call Form_Load
End Sub

Private Sub webbrowser1_documentcomplete(ByVal pDisp As Object, URL As Variant)

a = WebBrowser1.Document.body.innertext
s = Mid(a, InStr(a, "服务器时间:") + 6, 25)
MsgBox s
End Sub

运行老是显示:实时错误'-1(fffffff)'

哪个高手帮忙回答下啊
将WebBrowser1.Navigate "http://www.timedate.cn/worldclock/ti.asp" 放到TIMER中也是这个错误

我的目的就是想不断地读那个服务器的时间

Private Sub Form_Load()
Timer1.Interval = 2000
WebBrowser1.Navigate "http://www.timedate.cn/worldclock/ti.asp"
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
WebBrowser1.Refresh
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
If Text = "完毕" Then
Print WebBrowser1.Document.Body.Innertext
Timer1.Enabled = True
End If
End Sub

就可以实现你的目的了,测试过了,你自己试看看.

程序改一下吧:

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.timedate.cn/worldclock/ti.asp"
End Sub

Private Sub Timer1_Timer()
a = WebBrowser1.Document.body.innertext
s = Mid(a, InStr(a, "服务器时间:") + 6, 25)
Label1.Caption =