Imports System.Net
Public Class Form1
Public WithEvents Download As New WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FolderBrowserDialog1.ShowDialog()
LbSaveAddress.Text = FolderBrowserDialog1.SelectedPath
Download = New WebClient
Download.DownloadFileAsync(New Uri(txtURL.Text), LbSaveAddress.Text + "\" + txtSaveFileName.Text)
End Sub
Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged
Button1.Text = "Downloading"
ProgressBar1.Value = e.ProgressPercentage
Label2.Text = e.ProgressPercentage & "%"
End Sub
Private Sub txtURL_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtURL.MouseDown
txtSaveFileName.Text = "Default.exe"
End Sub
End Class
No comments:
Post a Comment