Results 1 to 4 of 4

Thread: [RESOLVED] DownloadFileAsync no progress

  1. #1

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Resolved [RESOLVED] DownloadFileAsync no progress

    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:
    1. Private WithEvents wClient As New WebClient
    2.  
    3.     Private Sub frm_main_update_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.         Try
    5.             Dim wClient As New WebClient
    6.             wClient.DownloadFileAsync(New Uri("http://www.website.com/file.exe"), Application.StartupPath & "\file.exe")
    7.         Catch ex As Exception
    8.             MessageBoxEx.Show(Err.Number & vbNewLine & Err.Description)
    9.         End Try
    10.     End Sub
    11.  
    12.     Private Sub wClient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles wClient.DownloadProgressChanged
    13.         wClient_progress.Value = e.ProgressPercentage
    14.     End Sub
    15.  
    16.     Private Sub wClient_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles wClient.DownloadFileCompleted
    17.         MessageBoxEx.Show("Download complete", "Download", MessageBoxButtons.OK, MessageBoxIcon.Information)
    18.         Me.Close()
    19.     End Sub
    Last edited by Radjesh Klauke; Jun 17th, 2010 at 06:34 AM.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  2. #2
    Addicted Member Spirited Machine's Avatar
    Join Date
    May 2009
    Posts
    215

    Re: DownloadFileAsync no progress

    Nevermind, I was incorrect.
    Last edited by Spirited Machine; Jun 17th, 2010 at 07:41 AM.

  3. #3

    Re: DownloadFileAsync no progress

    Line 5: Dim wClient As New WebClient
    Remove it.

  4. #4

    Thread Starter
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: DownloadFileAsync no progress

    Thanks for the suggestion., but that didn't do it. I removed the form and created a new one. Now it works fine...


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width