How to make a advanced downloader

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
7 posts Page 1 of 1
Contributors
User avatar
Reaper
Linux Users
Linux Users
Posts: 20
Joined: Tue Oct 04, 2011 9:22 pm

How to make a advanced downloader
Reaper
Here i am going to show you how to make an Advanced Downloader with Visual Basic 2008/2010 .

What u need :
3x TextBoxes
3x Buttons
1xFolderBrowserDialog
1xProgressBar
1xLabel

First Add this "Imports" over the Form Code
Code: Select all
Imports System.IO
Imports System.NET
TextBox1 is for the File Download URL
TextBox2 for the Folder where it Saves the Files
TextBox3 for the FileName

Add this Declarations under the Public Class Form Code
Code: Select all
Public WithEvents downloader As New WebClient
    Dim Link As String = TextBox1.Text
    Dim Path As String = TextBox2.Text
    Dim FileName As String = TextBox3.Text

Then Go to your Project Settings "My Project" and go under Settings and a New Setting Named "DownloadFolder"

FormLoad Code
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If My.Settings.DownloadFolder = "" Then
            TextBox2.Text = ""
        Else
            TextBox2.Text = My.Settings.DownloadFolder
        End If
    End Sub

Each Time you Open the Downloader it will automaticilly gets the Folder then where you want to Save your Files.

Change Text from Button1 to "..." or "Browse" and Place it at the Left,Right or whatever of TextBox2
Button1 Code
Code: Select all
FolderBrowserDialog1.ShowDialog()
        If FolderBrowserDialog1.SelectedPath = "" Then

        Else
            Path = FolderBrowserDialog1.SelectedPath
            My.Settings.DownloadFolder = Path
            My.Settings.Save()
        End If
Change Text from Button2 to "Download" and Button3 to "Abort Download"
Button2 Code
Code: Select all
Try
            If TextBox1.Text = "" & TextBox2.Text = "" & TextBox3.Text = "" Then

            Else
                downloader.DownloadFileAsync(New Uri(link), Path & FileName)
            End If
        Catch
            MsgBox("A Error appeared!", MsgBoxStyle.Information)
        End Try

Button3 Code
Code: Select all
downloader.CancelAsync()

Downloader DownloadFinished Event Code
Code: Select all
MsgBox("Download completed!", MsgBoxStyle.Information)

ProgressBar1 ProgressChanged Event Code
Code: Select all
ProgressBar1.Minimum = 0
         ProgressBar1.Maximum = 100
         ProgressBar1.Value = e.ProgressPercentage
         Label1.text = e.ProgressPercentage

All Credit too Napster1448
Image
Image
Image
Image
Image
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Could use a little explanation. Nice tutorial though. Good job cooll;
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Awesome tutorial :D
User avatar
clanc789
Coding Guru
Coding Guru
Posts: 786
Joined: Tue Nov 02, 2010 4:45 pm

Looks great!
Practice makes perfect!

VIP since: 6-10-2011
User avatar
mrstean
VIP - Donator
VIP - Donator
Posts: 12
Joined: Sat Jun 18, 2011 4:12 pm

Nice Tutorial Thanks! :)
User avatar
Acem
VIP - Donator
VIP - Donator
Posts: 19
Joined: Wed Oct 19, 2011 6:49 pm

Re: How to make a advanced downloader
Acem
Thanks Reaper ,but you have been getting in trouble lately.
From,
Acem
User avatar
shor6284
Just Registered
Just Registered
Posts: 7
Joined: Sun Feb 27, 2011 10:57 pm

Thankyou
http://codeforums.freeforums.org/
7 posts Page 1 of 1
Return to “Tutorials”