注册 登录
编程论坛 VB.NET论坛

用vb.net做的一个股票数据下载程序

xyxcc177 发布于 2018-03-11 14:30, 3236 次点击
有新需求进一步完善。
只有本站会员才能查看附件,请 登录
3 回复
#2
陈亮丹顿2018-03-23 23:16
作的不错,开源一下代码,让大家学习一下就更好了。
#3
不说也罢2018-03-24 16:33
我下载了,先学习下。

——————非源码,又删了
#4
xyxcc1772018-03-31 14:06
程序代码:


 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




其它没有什么了
1