Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Public Class Download
- Public Shared Function Download_File(ByVal URL_ As String, ByVal Path_ As String)
- Dim Download_Handle As New Net.WebClient
- AddHandler Download_Handle.DownloadProgressChanged, AddressOf DownloadProgressCallback
- Download_Handle.DownloadFileAsync(New Uri(URL_), Path_)
- Return 0
- End Function
- Public Shared Sub DownloadProgressCallback(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
- Dim File_Size As Long = e.TotalBytesToReceive
- Dim File_Received As Long = e.BytesReceived
- Dim Progress As String = String.Format("{0} kB / {1} kB - {2}%", Math.Round((File_Received / 1024)), Math.Round((File_Size / 1024)), e.ProgressPercentage)
- If e.ProgressPercentage = 100 Then
- MessageBox.Show("Download complete!", "100%")
- End If
- End Sub
- End Class
Add Comment
Please, Sign In to add comment