Imports System.Net Public Class Download WithEvents WebIllyria As New Net.WebClient 'WithEvents WebClient As New Net.WebClient Private Sub Download_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Uri As New Uri("ftp://illyriapatch@ftp.drivehq.com/illyria.exe") Try WebIllyria.Credentials = New Net.NetworkCredential("username", "password") WebIllyria.DownloadFileAsync(Uri, "c:\illyria.exe") Catch ex As Exception MsgBox(ex.ToString) End Try End Sub Private Sub WebIllyria_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles WebIllyria.DownloadProgressChanged ProgressDownload.Value = e.ProgressPercentage Label4.Text = e.TotalBytesToReceive Label3.Text = e.BytesReceived Label2.Text = e.ProgressPercentage & "%" If ProgressDownload.Value = 100 Then MessageBox.Show("Download Completed!!") Label2.Text = "..." End If End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)