我的VB项目无法下载exe文件

时间:2014-04-21 23:05:21

标签: vb.net file download

我有一个更新对话框,当按下“直接下载”按钮时,它用于从保管箱位置下载exe文件。但是,现在它不再下载文件了,它意味着在下载后启动文件,但它会说:找不到文件。

代码是:

Dim TempPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Temp"
    Try
        My.Computer.FileSystem.DeleteFile(TempPath & "\animeygocardmaker.exe")
        My.Computer.Network.DownloadFile("https://dl.dropboxusercontent.com/u/72383434/animeygocardmaker.exe", TempPath & "\animeygocardmaker.exe")
    Catch ex As Exception
        MsgBox("An error occured while trying to download the file")
    End Try

    System.Diagnostics.Process.Start(TempPath & "\animeygocardmaker.exe")
    Dim CloseAllWindows As New CloseAll
    Form1.Pause()
    CloseAllWindows.CloseAll()

就像我说的那样,它总是习惯性的。问题可能是文件下载时间太长了吗?

1 个答案:

答案 0 :(得分:0)

        Dim TempPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Temp"
    Try
        My.Computer.Network.DownloadFile("https://dl.dropboxusercontent.com/u/72383434/animeygocardmaker.exe", TempPath & "\animeygocardmaker.exe")

        System.Diagnostics.Process.Start(TempPath & "\animeygocardmaker.exe")
        Dim CloseAllWindows As New CloseAll
        Form1.Pause()

    Catch ex As Exception
        MsgBox("An error occured while trying to download the file" + ex.ToString)
    End Try
    CloseAllWindows.CloseAll()