Imports System.IO
Imports System.Net
Public Class Form1
Private WithEvents httpclient As WebClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
httpclient = New WebClient
Dim sourceurl = "http://yoursite.com/directory/"
Dim filedir = My.Application.Info.DirectoryPath.ToString & "\" & "file.exe"
Try
httpclient.DownloadFileAsync(New Uri(sourceurl), (filedir))
Catch ex As Exception
MsgBox("Faild" & ErrorToString(), MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub httpclient_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles httpclient.DownloadFileCompleted
End Sub
End Class