程序代码:
Private Sub GetImage(ByVal strUrl As String, ByVal Pict As PictureBox) '显示网上图片程序
Try
Dim request As HttpWebRequest = WebRequest.Create(strUrl)
request.Timeout = 20000
request.ServicePoint.ConnectionLimit = 100
request.ReadWriteTimeout = 30000
request.Method = "GET"
Dim response As HttpWebResponse = request.GetResponse()
If (response.StatusCode <> HttpStatusCode.OK) Then
Exit Sub
End If
Dim resStream As Stream = response.GetResponseStream()
Pict.Image = New Bitmap(resStream) '这个是winform中的控件
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted '用webbrowser控件解析表格数据
Try
bk_tity += 1
If bk_tity = 5 Then
Dim j As Int16 = 0
bk_tity = 0
hy_Table.Clear()
Dim tr_arr As HtmlElementCollection
Dim k As Int16
Dim sVal_1 As HtmlElement
Dim sVal As HtmlElement
tr_arr = WebBrowser1.Document.GetElementsByTagName("table")(0).GetElementsByTagName("tr")
Dim ct As Int16 = tr_arr.Count - 1
For Each sVal_1 In tr_arr
If j > 0 And j < ct Then
k = 0
Dim dRow As DataRow = hy_Table.NewRow
For Each sVal In sVal_1.GetElementsByTagName("td")
dRow(k) = sVal.OuterText
k = k + 1
Next
hy_Table.Rows.Add(dRow)
End If
j += 1
Next
End If
Catch ex As Exception
End Try
End Sub
其它没有什么了