刚才那个是不行的,只读第一个包的网页源代码……
这个是用webclient的,有点.net的感觉了。
这个是用webclient的,有点.net的感觉了。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim data As String
Dim data2 As String
Try
wc = New System.Net.WebClient()
If Not (TextBox1.Text Like "http://*") Then
TextBox1.Text = "http://" + TextBox1.Text
End If
b = wc.DownloadData(TextBox1.Text)
data = System.Text.Encoding.Default.GetString(b)
'strm = wc.OpenRead(TextBox1.Text)
'sr = New System.IO.StreamReader(strm)
'data = sr.ReadToEnd.ToString
data2 = data.Replace(ControlChars.Lf, ControlChars.CrLf)
RichTextBox1.Text = data2
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
可以看出我本来想用stream的,最终还是放弃了,是什么问题我以后会找一下。
Dim data As String
Dim data2 As String
Try
wc = New System.Net.WebClient()
If Not (TextBox1.Text Like "http://*") Then
TextBox1.Text = "http://" + TextBox1.Text
End If
b = wc.DownloadData(TextBox1.Text)
data = System.Text.Encoding.Default.GetString(b)
'strm = wc.OpenRead(TextBox1.Text)
'sr = New System.IO.StreamReader(strm)
'data = sr.ReadToEnd.ToString
data2 = data.Replace(ControlChars.Lf, ControlChars.CrLf)
RichTextBox1.Text = data2
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub