Network.DownloadFile with progressbar
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts
Page 1 of 1
How can i use
Code: Select all
with a progressbar to show its progress in downloading ? My.Computer.Network.DownloadFile
You can't.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

MrAksel wrote:You can't.Is there other download methods where i can use it then ?
Code: Select all
I think this would work. I haven't tested it.Dim req As HttpWebRequest = DirectCast(WebRequest.Create("http://www.server.com/file.txt"), HttpWebRequest)
Dim res As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
Dim stream As Stream = res.GetResponseStream()
Dim file As FileStream = New FileStream("C:\file.txt", FileMode.Create, FileAccess.Write)
ProgressBar1.Maximum = res.ContentLength
Dim Buffer As Byte() = New Byte(4095) {}
Dim count As Integer = 0
Dim max As Integer = res.ContentLength
Do While(count < max)
Dim read = stream.Read(buffer, 0, 4096)
file.Write(buffer, 0, read)
count += read
ProgressBar1.Value = count
Application.DoEvents()
Loop
file.Close()
stream.Close()
res.Close()
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023