-
Oct 15th, 2010, 05:37 AM
#121
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.
-
Jan 26th, 2012, 09:10 AM
#122
New Member
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!!!
-
Jan 26th, 2012, 01:33 PM
#123
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:
Using wClient As New WebClient
wClient.DownloadFile("URL", "FilePath")
End Using
Last edited by Chris001; Jan 26th, 2012 at 01:36 PM.
-
Jan 26th, 2012, 07:07 PM
#124
New Member
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!
-
Sep 12th, 2013, 10:21 PM
#125
New Member
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
-
Sep 18th, 2013, 04:45 PM
#126
Addicted Member
Re: Download Files From Web With Progressbar
Originally Posted by Brocke
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.
-
Oct 29th, 2013, 07:20 PM
#127
New Member
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
-
Oct 31st, 2013, 09:47 AM
#128
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.
-
Nov 23rd, 2013, 01:02 PM
#129
Fanatic Member
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 ..
-
Mar 3rd, 2016, 02:16 AM
#130
Registered User
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.
-
Sep 26th, 2016, 03:29 PM
#131
Re: Download Files From Web With Progressbar
Originally Posted by kleinma
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.
-
Jul 13th, 2018, 01:17 PM
#132
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|