6

我正在尝试从互联网 .txt 文件中读取几个数字并将其显示在文本框中,但没有结果...

这些系统是进口的:

Imports System.IO
Imports System.Text
Imports System.Net

下面是读取文件的代码:

Dim address As String = "http://www.url.com/text.txt"
Dim client As WebClient = New WebClient()
Dim reply As String = client.DownloadString(address)
TextBox2.Text = reply
4

1 回答 1

12

试试这个:

Dim address As String = "http://www.stackoverflow.com"
Dim client As WebClient = New WebClient()
Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
Textbox2.Text = reader.ReadToEnd
于 2013-05-20T18:20:00.013 回答