Dim client As WebClient = New WebClient()
Dim ar As WebRequest
'change www.yoursite.com to a web page and what you want to download.
Dim wr As HttpWebRequest = CType(WebRequest.Create("http://www.asd.net/prog/asd.exe"), HttpWebRequest)
AddHandler client.DownloadProgressChanged, AddressOf aaaddd
AddHandler client.DownloadFileCompleted, AddressOf dddaaa
Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
Dim str As Stream = ws.GetResponseStream()
Dim inBuf(100000) As Byte
Dim bytesToRead As Integer = CInt(inBuf.Length)
Dim bytesRead As Integer = 0
While bytesToRead > 0
Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
If n = 0 Then
Exit While
End If
bytesRead += n
bytesToRead -= n
End While
'change C:\something.exe to the directory you are going to put the file, and what you are going to name it.
Dim fstr As New FileStream("asd.exe", FileMode.OpenOrCreate, FileAccess.Write)
fstr.Write(inBuf, 0, bytesRead)
str.Close()
fstr.Close()
Sub aaaddd(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
ProgressBar2.Value = e.ProgressPercentage
End Sub
Sub dddaaa(ByVal sender As Object, ByVal e As DownloadStringCompletedEventArgs)
End SubSorunum Dosyayı Sıteden Sorunsuz ındırıyor Fakat Indırırken Acılısta Donuyor Biraz İndirince Devam Ediyor Progress Barda Çalışmıyor Yardımcı Olurmusunuz
[VB.NET]Progress Bar Download Sorunu
2
●806
- 20-07-2010, 14:26:59Arkadaslar Burası Form Load da Ekli