我想爲我的程序做一個下載管理器。但是當我運行這個代碼時,它給了我消息框中的「下載入門」,但就是這樣。我沒有下載任何文件或進度條更改?有誰知道爲什麼?VB.net Webclient.DownloadFileAsync不下載
Public Class frmDownloader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebClient1.DownloadFileAsync(New Uri("https://s3.amazonaws.com/MinecraftDownload/launcher/Minecraft_Server.exe"), "C:\hi.exe")
MsgBox("download started")
End Sub
Private Sub WebClient1_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles WebClient1.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
MsgBox("Download Progress Changed")
End Sub
End Class
相關的主題 - http://stackoverflow.com/questions/2826190/does-webclient-openfileasync-fire-downloadprogresschanged – adatapost