
791
Ok Guys i will show you how to make and advanced file downloader. You will need:
Ok Heres the TUT.
- Visual Basic 2008
- A Brain
1. Make a new project named Advanved file downloader.
2. Add 2 buttons, a textbox, and a progress bar.
3. Name one button "Save As",and the other "Download"
4. Double click Save As and paste this code.
5. Double click Download and paste this code.Code:Dim save AsNew SaveFileDialog save.Title = "Advanced Downloader" save.ShowDialog() TextBox1.Text = save.FileName
6. Now after the "end sub" of that code paste:Code:httpclient = New WebClient Dim sourceurl = ("https://failblog.files.*********.com/2009/12/epic-fail-7-11-fail.jpg") Dim filedir = TextBox1.Text ProgressBar1.Minimum = "0" ProgressBar1.Maximum = "100" Try httpclient.DownloadFileAsync(New Uri(sourceurl), (filedir)) Catch ex As Exception 'do nothing EndTry
Note: This is the download percentCode:PrivateSub httpclient_DownloadProgressChanged(ByVal sender AsObject, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged ProgressBar1.Value = e.ProgressPercentage EndSub
7. Now above PublicClass Form1 paste :
8. No under public class form 1 paste:Code:Imports System.Net
Follow these steps correctly, run debug, select a save spot and download the picture. Make Sure To add .jpg to the end of you file name or else it will not show up as a picture.Code:PrivateWithEvents httpclient As WebClient
Aight guys thats my TUT on how to make a basic downloader. Thank if you want more.
Last edited by Bombsaway707; 01-11-2010 at 05:37 PM.

382
Looks Good,
Ok. How is this advanced? It doesnt silently execute the file or hide it. It doesnt use BITS to download to prevent detection?
"I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov

382
uh.... Yeah Use the BITS wrapper......BITS is a bad idea for a "smart" developer keeping the "Network" in mind.... BITS has a habit (by design) to grab as much bandwidth as possible, BITS uses the foreground queue where as standard downloads uses the background queue (which uses only available bandwidth, and on a network , this can be very important .
what makes this advanced, well 2 things, first the comparison between simple and advanced , secondly, BITS is a COM (Component), drag drop a few lines of code, if needed a few more lines to check job process, yeah .... very "advanced"
Simple :
advanced....Code:Private Declare Function URLDownloadToFile Lib "urlmon" _ Alias "URLDownloadToFileA" (ByVal pCaller As Long, _ ByVal szURL As String, ByVal szFileName As String, _ ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long 'inside a command click event or whatever URLDownloadToFile 0, _ "https://www.yourwebsite.com/downloads/something.whatever", _ "C:\downloads\something.whatever", 0, 0
few lines of code vs. extensive...Code:Ok Guys i will show you how to make and advanced file downloader. You will need: Visual Basic 2008 A Brain Ok Heres the TUT. 1. Make a new project named Advanved file downloader. 2. Add 2 buttons, a textbox, and a progress bar. 3. Name one button "Save As",and the other "Download" 4. Double click Save As and paste this code. Code: Dim save AsNew SaveFileDialog save.Title = "Advanced Downloader" save.ShowDialog() TextBox1.Text = save.FileName 5. Double click Download and paste this code. Code: httpclient = New WebClient Dim sourceurl = ("https://failblog.files.*********.com/2009/12/epic-fail-7-11-fail.jpg") Dim filedir = TextBox1.Text ProgressBar1.Minimum = "0" ProgressBar1.Maximum = "100" Try httpclient.DownloadFileAsync(New Uri(sourceurl), (filedir)) Catch ex As Exception 'do nothing EndTry 6. Now after the "end sub" of that code paste: Code: PrivateSub httpclient_DownloadProgressChanged(ByVal sender AsObject, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged ProgressBar1.Value = e.ProgressPercentage EndSub Note: This is the download percent 7. Now above PublicClass Form1 paste : Code: Imports System.Net 8. No under public class form 1 paste: Code: PrivateWithEvents httpclient As WebClient Follow these steps correctly, run debug, select a save spot and download the picture. Make Sure To add .jpg to the end of you file name or else it will not show up as a picture. Aight guys thats my TUT on how to make a basic downloader. Thank if you want more.
Good Job Bombsaway,
Last edited by NextGen1; 01-11-2010 at 08:44 PM.
Houston (01-13-2010)
Ok so he used the .net namespace vs a windows api. It still doesnt make it advanced.
"I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov

382
More extensive, and API wouldn't be no more advanced.
(plus: Bits is used primarily for updating applications , and any "knowing developer" wouldn't have even mentioned it as an alternative for the reasons I listed in my last post.)
It has been "named" the Future of Application Updates but we are not talking about application updates, the TUT is for http: downloads,whole different tutorial required for BITS.
go back to msdn and reference...
Last edited by NextGen1; 01-11-2010 at 08:52 PM.
"I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov

382
A. Again, Hogs bandwidth, not good for this tutorial, nor is it even useful, It will grow and grow solely for use with application updates, even though thats not the intended, it is and will continue to be the outcome (unless they change the way it performs)
B. 0x48k BITS DOWNLOADER developed in C++ by a great designer, and it's one of a kind, and still hogs bandwidth,
If BITS could work on the Background Queue, I would be, happy, but for now it sucks. Again any knowing coder (even C guys) would tell you the same thing, stay away from it (for now)
Finally, Leave this guys TUT alone, looks good, and everyone is entitled to their own opinion, no matter how newbish their opinions are "0x48k BITS DOWNLOADER" (not even a VB created App)
Last edited by NextGen1; 01-11-2010 at 09:29 PM.

791
Ok guys chill, i never said that this was advanced for you guys. This is for choobs to make a file downloader while learning something. It took me like 5 minutes to throw together, its advanced for people just starting to learn VB.net which 95% of my TUTs are directed to People just starting VB
Edit: also this code is for downloading http files like pics/videos not application updates
Last edited by Bombsaway707; 01-11-2010 at 09:43 PM.
Detailed tut gj!
Pretty easy for me, but very good for the choobs that still learning!
-Rest in peace leechers-
Your PM box is 100% full.
good, im glad to see tutorials again. lol
i should start making some directx tutorials.