Public Class Form1 Dim downloadsize As Long Dim Downloadedsize As Long Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim req As Net.HttpWebRequest Dim resp As Net.HttpWebResponse req = Net.HttpWebRequest.Create("http://xyz.com/index.php/directory/download?location=A Level/Chemistry/Edexcel/2012 Jan/6CH08_01_msc_20120209.pdf") req.AllowAutoRedirect = True resp = req.GetResponse req.Method = Net.WebRequestMethods.Http.Get downloadsize = resp.ContentLength ProgressBar1.Maximum = downloadsize BackgroundWorker1.RunWorkerAsync() Timer1.Start() End Sub Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork My.Computer.Network.DownloadFile("http://xyz.com/index.php/directory/download?location=A Level/Chemistry/Edexcel/2012 Jan/6CH08_01_msc_20120209.pdf", "D:\edexcellogo.pdf", "", "", False, 60000, True) End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Downloadedsize = My.Computer.FileSystem.GetFileInfo("D:\pp.doc").Length ProgressBar1.Value = Downloadedsize End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)