webbrowser刷新后如何重新激发DocumentCompleted事件
PrivateSubForm1_Load(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMe.LoadWebBr...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
WebBrowser1.Navigat("http://zj.zjgold99999.com.cn/b/ppp/index.asp")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim doc As Object
Dim i As Object
Dim strHtml As String = ""
doc = WebBrowser1.Document
For Each i In doc.All
strHtml = strHtml & Chr(13) & i.innerText
Next
Dim b As String = strHtml
Dim a As String = InStr(b, "中国黄金实时基础金价:")
Dim c As String = Mid(b, a, Len(b))
TextBox1.Text = c
Label2.Text = Mid(c, 12, 6)
Dim d As String = InStr(c, "零售价")
Label7.Text = Mid(c, Convert.ToInt32(d) + 4, 6)
Dim ee As String = InStr(c, "回购价")
Label8.Text = Mid(c, Convert.ToInt32(ee) + 4, 6)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
WebBrowser1.Refresh()
end sub
刷新后label控件的值不会变~请问如何在刷新后重新激活WebBrowser1_DocumentCompleted 展开
WebBrowser1.Navigat("http://zj.zjgold99999.com.cn/b/ppp/index.asp")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim doc As Object
Dim i As Object
Dim strHtml As String = ""
doc = WebBrowser1.Document
For Each i In doc.All
strHtml = strHtml & Chr(13) & i.innerText
Next
Dim b As String = strHtml
Dim a As String = InStr(b, "中国黄金实时基础金价:")
Dim c As String = Mid(b, a, Len(b))
TextBox1.Text = c
Label2.Text = Mid(c, 12, 6)
Dim d As String = InStr(c, "零售价")
Label7.Text = Mid(c, Convert.ToInt32(d) + 4, 6)
Dim ee As String = InStr(c, "回购价")
Label8.Text = Mid(c, Convert.ToInt32(ee) + 4, 6)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
WebBrowser1.Refresh()
end sub
刷新后label控件的值不会变~请问如何在刷新后重新激活WebBrowser1_DocumentCompleted 展开
展开全部
最笨的方法,不要管什么完成事件了,定时器刷新后,直接读取网页源代码处理即可。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
重新设置webbrowser的navigate("")
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
试试用Navigated事件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
刷新前,加一句:
webbrowser.stop
一切ok
webbrowser.stop
一切ok
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询