webclint progressbar

VNote 2017.07.23 17:35:01 *: Imports System.Net
Public Class Form1

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Label1.Text = My.Application.Info.DirectoryPath & "\dddd.exe"
Dim wc As New WebClient
AddHandler wc.DownloadProgressChanged, AddressOf DownloadProgressChanged
AddHandler wc.DownloadFileCompleted, AddressOf DownloadFileCompleted
wc.DownloadFileAsync(New System.Uri("http://aaa.com/aaa.zip"), "D:\aaa.zip")
End Sub

Public Sub DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs)
ProgressBar1.Value = e.ProgressPercentage
Label1.Text = (e.BytesReceived / 1024) & " / " & (e.TotalBytesToReceive / 1024)
End Sub

Public Sub DownloadFileCompleted(sender As Object, e As EventArgs)
MsgBox("dd")
End Sub

End Class