I'm so...
I'm trying to download a file, which works fine, but the progressbar is showing me no progress and because of that the form doesn't close. Could anyone tell me what is/could be wrong with my code. The weird thing is that the same code is working in my another app.
vb.net Code:
Private WithEvents wClient As New WebClient Private Sub frm_main_update_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Dim wClient As New WebClient wClient.DownloadFileAsync(New Uri("http://www.website.com/file.exe"), Application.StartupPath & "\file.exe") Catch ex As Exception MessageBoxEx.Show(Err.Number & vbNewLine & Err.Description) End Try End Sub Private Sub wClient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles wClient.DownloadProgressChanged wClient_progress.Value = e.ProgressPercentage End Sub Private Sub wClient_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles wClient.DownloadFileCompleted MessageBoxEx.Show("Download complete", "Download", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Close() End Sub






Reply With Quote