請試試以下範例,我有測過,有問題再回應:
Imports System.Net
Imports System.Text
Imports System.IO
.....
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim req As WebRequest = WebRequest.Create("http://tw.stock.yahoo.com/")
Dim res As WebResponse = req.GetResponse()
Dim recS As Stream = res.GetResponseStream()
Dim enc As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim sread As New StreamReader(recS, enc)
Dim s As String
s = ""
Dim read(256) As [Char]
Dim count As Integer = sread.Read(read, 0, 256)
Label1.Text = "receiving"
While count > 0
Dim str As New [String](read, 0, count)
Application.DoEvents()
s = s + str
count = sread.Read(read, 0, 256)
Label1.Text = Label1.Text + "."
End While
s = s + ControlChars.CrLf
sread.Close()
res.Close()
TextBox1.Text = s
End Sub