Dim instance As WebClient
Dim address As String
Dim avoids as string
address = "http://www.ecosavetech.com/avoid.txt"
avoids = instance.DownloadString(address)
MsgBox(avoids)
msgbox没有显示任何内容。
请帮忙!我也没有收到任何错误
我正在使用Imports System.Net
答案 0 :(得分:4)
你确定你没有收到任何错误?您的代码在未引用实例的变量上调用DownloadString
方法。你可能也希望创建一个WebClient
:
Dim instance As New WebClient()
Dim address As String
Dim avoids As Atring
address = "http://www.ecosavetech.com/avoid.txt"
avoids = instance.DownloadString(address)
MsgBox(avoids)
答案 1 :(得分:4)
在您共享的代码中,您实际上并未创建WebClient。
Dim instance as WebClient = new WebClient()