Amrykid

I WANT TO MAKE A DOWNLOAD MANAGER FOR MY WEB BROWSER AND I ALL READY MADE TO POST ABOUT IT. mY PROBLEM IS that my progressbar doesn't move while downloading. i tryed the webclient Download Progress changed event but still no dice. Please help!!!

Code Block

Public Class Downloader

Delegate Sub ChangeTextsSafe(ByVal length As Long, ByVal position As Integer, ByVal percent As Integer, ByVal speed As Double)

Private Sub Download_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

SaveFileDialog1.Filter = "Files(*.*)|*.*"

SaveFileDialog1.FilterIndex = 1

SaveFileDialog1.RestoreDirectory = True

If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

ProgressBar1.Increment("30")

WebClient1.DownloadFile(TextBox1.Text, SaveFileDialog1.FileName)

If My.Computer.FileSystem.FileExists(SaveFileDialog1.FileName) = True Then

ProgressBar1.Increment("70")

End If

TextBox1.Enabled = False

End If

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

End Sub

Private Sub WebClient1_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles WebClient1.DownloadFileCompleted

ProgressBar1.Value = "100"

End Sub

Private Sub WebClient1_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles WebClient1.DownloadProgressChanged

ProgressBar1.Maximum = e.ProgressPercentage

ProgressBar1.Step = e.ProgressPercentage

ProgressBar1.Value = e.BytesReceived

End Sub

End Class



Re: Visual Basic Express Edition dOWNLOAD MANAGER IN vb!!!!!!!!!!!!!!! i need alot of help with this!!!!!

Amrykid

come on people u got to know this




Re: Visual Basic Express Edition dOWNLOAD MANAGER IN vb!!!!!!!!!!!!!!! i need alot of help with this!!!!!

js06

try removing this line

ProgressBar1.Maximum = e.ProgressPercentage

to test it out you can set the maximum to a general number before you do the download

then you need to do as reneeC said and set it to the number of bytes in the file at some point






Re: Visual Basic Express Edition dOWNLOAD MANAGER IN vb!!!!!!!!!!!!!!! i need alot of help with this!!!!!

ReneeC

After seeing this code, I understand your username better.

ProgressBar1.Maximum = e.ProgressPercentage

ProgressBar1.Step = e.ProgressPercentage

ProgressBar1.Value = e.BytesReceived

This is wired wrong.

ProgressBar.Maximum has to be set to the total number of bytes you intend to copy.

Value should equal the number of bytes you have received.