标题:VB求助如何读取服务器上的文本文件?
取消只看楼主
沉默的痞子
Rank: 4
等 级:贵宾
威 望:12
帖 子:96
专家分:127
注 册:2015-10-7
结帖率:45%
已结贴  问题点数:20 回复次数:0 
VB求助如何读取服务器上的文本文件?
以下是在.net论坛找到的代码,看不懂,不知道怎么用,VB怎么弄

Imports
Imports
Public Class Form1
    Private Function GetUrlFileText(ByVal FileUrl As String) As String
          'FileUrl 是你要读取的远程文件的完整路径,如: https://bbs.bccn.net/Temp/Text.txt
        Dim MyUrl As New Uri(FileUrl)
        Dim MyQuest As WebRequest = WebRequest.Create(MyUrl)
        Dim resp As WebResponse = MyQuest.GetResponse()
        Dim MyStr As Stream = resp.GetResponseStream()
        Dim read As StreamReader = New StreamReader(MyStr, System.Text.Encoding.Default)
        Dim tmpStr As String = read.ReadToEnd
        read.Close()
        Return tmpStr
    End Function
End Class
_______________________________
搜索更多相关主题的帖子: VB 读取 System Dim read 
2018-02-06 15:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-484645-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.240672 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved