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
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
TextBox2 for the Folder where it Saves the Files
TextBox3 for the FileName
Add this Declarations under the Public Class Form Code
Then Go to your Project Settings "My Project" and go under Settings and a New Setting Named "DownloadFolder"
FormLoad Code
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
Button2 Code
Button3 Code
Downloader DownloadFinished Event Code
ProgressBar1 ProgressChanged Event Code
All Credit too Napster1448
What u need :
3x TextBoxes
3x Buttons
1xFolderBrowserDialog
1xProgressBar
1xLabel
First Add this "Imports" over the Form Code
Code: Select all
TextBox1 is for the File Download URLImports System.IO
Imports System.NET
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
Change Text from Button2 to "Download" and Button3 to "Abort Download"FolderBrowserDialog1.ShowDialog()
If FolderBrowserDialog1.SelectedPath = "" Then
Else
Path = FolderBrowserDialog1.SelectedPath
My.Settings.DownloadFolder = Path
My.Settings.Save()
End If
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
Could use a little explanation. Nice tutorial though. Good job cooll;
Looks great!
Practice makes perfect!
VIP since: 6-10-2011
VIP since: 6-10-2011
Thanks Reaper ,but you have been getting in trouble lately.
From,
Acem
Acem
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023