Torna al Thread
Imports System.Net
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SaveFileDialog1.Filter = "JPeg Image|*.jpg|.exe|*.exe|.rar|*.rar|.zip|*.zip|.mp3|*.mp3|.flv|*.flv|.txt|*.txt|*.*|.*"
SaveFileDialog1.ShowDialog()
TextBox2.Text = SaveFileDialog1.FileName
End Sub
Public WithEvents download As WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
download = New WebClient
download.DownloadFileAsync(New Uri(TextBox1.Text), TextBox2.Text)
End Sub
Private Sub download_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles download.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub download_DownloadDataCompleted(sender As System.Object, e As System.Net.DownloadDataCompletedEventArgs) Handles download.DownloadDataCompleted
ProgressBar1.Value = e.Cancelled
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class