Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- If Downloading Then Exit Sub
- Downloading = True
- Dim wc As New WebClient
- AddHandler wc.DownloadProgressChanged, AddressOf wc_ProgressChanged
- AddHandler wc.DownloadFileCompleted, AddressOf wc_DownloadDone
- wc.DownloadFileAsync(New Uri("http://speedtest.ftp.otenet.gr/files/test100Mb.db"), tmp, Stopwatch.StartNew)
- End Sub
- Private Sub wc_DownloadDone(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs)
- Downloading = False
- End Sub
- Private Sub wc_ProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs)
- Me.Label2.Text = (e.BytesReceived / (DirectCast(e.UserState, Stopwatch).ElapsedMilliseconds / 1000.0#)).ToString("#")
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement