As a bit of practice I am trying to get my program to download a file via the progress bar. It downloads it fine and the progress bar follows but the problem is that after the download is complete it wont reset. This is the code for the button and the bar.
Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click
WC.DownloadFileAsync(New Uri("imageurlhere"), "c:\myfile.jpg")
If ProgressBar1.Value = ProgressBar1.Maximum Then
ProgressBar1.Value = ProgressBar1.Minimum
End If
End Sub
Private Sub WC_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles WC.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
End Sub
Try this
Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click
WC.DownloadFileAsync(New Uri("imageurlhere"), "c:\myfile.jpg")
End Sub
Private Sub WC_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles WC.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
If ProgressBar1.Value = ProgressBar1.Maximum Then
ProgressBar1.Value = ProgressBar1.Minimum
End If
End Sub