Page 4 of 4 FirstFirst 1234
Results 121 to 132 of 132

Thread: Download Files From Web With Progressbar

  1. #121
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Download Files From Web With Progressbar

    Good job kleinma, Iv used your class in my project, Kept all your headers at the top. I assume thats allowed?

    My question, downloading a file http://www.file.com/file.exe of course works.

    My project is grabbing these types of links.

    Code:
    http://media.soundcloud.com/stream/eRv0K8mcxuUD?stream_token=RlIsi
    Will download file in a address bar in a browser but not your project.

    Any suggestions on adapting your code to handle these?

    edit***

    a little url manipulation sorted it

    sorry
    Last edited by ident; Oct 17th, 2010 at 01:50 PM.

  2. #122
    New Member
    Join Date
    Jan 2012
    Posts
    4

    Re: Download Files From Web With Progressbar

    Nicely done kleinma! I have similar questions as ident above, when I entered the following link into the tool:
    http://www.vbforums.com/showthread.php?t=396260

    I get an error "An error has occurred during download: Illegal characters in path."

    What should we modify in the code for the tool to download with those kind of links?

    Thanks!!!

  3. #123
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Download Files From Web With Progressbar

    It doesn't work, because the last part of the url "showthread.php?t=396260" is used as filename and you can't use question marks in a filename. In that case you'll need to remove the question mark.

    Btw, you don't need all this code. You can simply use the WebClient class and download a webpage with three lines of code.

    vb.net Code:
    1. Using wClient As New WebClient
    2.     wClient.DownloadFile("URL", "FilePath")
    3. End Using
    Last edited by Chris001; Jan 26th, 2012 at 01:36 PM.

  4. #124
    New Member
    Join Date
    Jan 2012
    Posts
    4

    Re: Download Files From Web With Progressbar

    Thanks Chris for your quick response! Based on explanation, I managed to change Function GetFileNameFromURL(ByVal URL As String) As String to remove "?" to make the file name valid.

    Now I will try the three lines of code if it works for me!

    Thanks a lot!

  5. #125
    New Member
    Join Date
    Sep 2013
    Posts
    3

    Re: Download Files From Web With Progressbar

    I need a little help and cant figure this out


    Im getting a error at this line

    Code:
    ProgressBar1.Maximum = Convert.ToInt32(iFileSize)
    it states that the file progress bar max cant be -1 when the download is size of ifilesize is -1

    the file im downloading is

    http://www.mediafire.com/download/2d...r_2012_INT.exe


    thank you for you help because im clueless right now lol

    Brock

  6. #126
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Re: Download Files From Web With Progressbar

    Quote Originally Posted by Brocke View Post
    I need a little help and cant figure this out


    Im getting a error at this line

    Code:
    ProgressBar1.Maximum = Convert.ToInt32(iFileSize)
    it states that the file progress bar max cant be -1 when the download is size of ifilesize is -1

    the file im downloading is

    http://www.mediafire.com/download/2d...r_2012_INT.exe


    thank you for you help because im clueless right now lol

    Brock
    It could be because of the fact that, that URL redirects you to another one in order to download the file, and the method you're using to download maybe doesn't support redirecting.

  7. #127
    New Member
    Join Date
    Sep 2013
    Posts
    3

    Re: Download Files From Web With Progressbar

    hey guys I need a little help here.

    For some reason I get this error using the download class.

    The process cannot access the file "" because it is being used by another process
    it doesn't happen all the time but im unsure why it happens.

    I've added a stop button but the file only gets deleted if they press the Stop button and when the file get down downloading it starts the file. But not sure why that error comes up once in a while.

    thank you
    Brock

  8. #128

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Download Files From Web With Progressbar

    What line of code do you get that error on? the error is pretty self explanatory, some process is holding a handle to that file when you are trying to delete it or append it.

  9. #129
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    Re: Download Files From Web With Progressbar

    I have downloaded WebDownloadWithProgress.zip .. it is really a great source code

    I want to use it with my application but need help

    I have listview with the items in form load event and each item has a download url associated with .. like when clicked listview item the url is displayed in checked listview .. how can i use WebDownloadWithProgress with this ...with every listview item different download url is shown in checked listview ..

  10. #130
    Registered User
    Join Date
    Jan 2016
    Posts
    6

    Re: Download Files From Web With Progressbar

    @TS hi i have downloaded your program and it's great, but my problem is i can't download files bigger than 20 MB, just like what you have said, but i have no idea on what i'm going to do to the solution that you were saying. can you help me please? I'm having an error that says Arithmetic operation resulted in an overflow.

  11. #131
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    Re: Download Files From Web With Progressbar

    Quote Originally Posted by kleinma View Post
    Here is a sample project I did up that uses a class I wrote (WebFileDownloader)

    The WebFileDownloader class provides methods for downloading a file from a URL and firing events to update progress in the GUI on a progress bar or whatever you may like.

    The standard WebClient class in the .NET framework has a method for downloading a file, but there is no indication of its progress as it downloads, which is why I wrote this up.

    Known limitations:
    progress is returned as a long, and a progress bar takes an integer, so in the sample I convert the long to integer, which could error in BIG downloaded files.. a better solution would be to use the filesize being downloaded and calculate a good maximum to set the progress bar to. However this is GUI related, and not related to the WebFileDownloader class itself. (Just wanted to point it out)

    Also make sure the URL is a full URL (ie http://www.mysite.com/file.zip and not www.mysite.com/file.zip)

    Please post any corrections you may find. I use this code all the time, but that doesn't mean there isn't a bug or 2 lurking somewhere
    I haven't looked at the code (this is older i know) but, couldnt you whereever your code is be something like this (using navigate for example)

    Code:
    webbrowser1.navigate("http://" + Url.text)
    also dunno if anyone has suggested this before - Thanks!
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  12. #132
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Download Files From Web With Progressbar

    Thanks Matt - I'm using your code - in a big old SQL loop - to pull 14,000 PDF's off of a site. Working like a charm!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Page 4 of 4 FirstFirst 1234

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