【问题标题】:Download .txt files from web using vb.net使用 vb.net 从 Web 下载 .txt 文件
【发布时间】:2015-02-08 15:44:23
【问题描述】:

我设法找到了一种从我可以访问的网站下载 .txt 文件的方法,这很棒,但我使用的是我添加到 datagridview 的文件名列表。

我的下一步是从网站的根目录和子目录下载任何 .txt 文件,但如果它存在于我的下载位置 c:\logs 中,它将跳过它。

感激地接受任何指示。 VBVirg

【问题讨论】:

    标签: vb.net download file-exists


    【解决方案1】:

    除了文森特的回答:

    Dim FilePath As String = "YourFile"
    If My.Computer.FileSystem.FileExists(FilePath) = True Then
        'File exists, delete it
        My.Computer.FileSystem.DeleteFile(FilePath)
    Else
        'The file doesn't exist.
    End If
    

    【讨论】:

      【解决方案2】:
      Dim _FilePath As String = "<file path and name here>"
      If My.Computer.FileSystem.FileExist(_FilePath) = True Then
          'File exists.
      End If
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-10-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-12
        • 2021-12-16
        相关资源
        最近更新 更多