tags:

views:

20

answers:

1

i have designed a web browser.except for the progress bar it is working fine.

this is my code:

Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
     ProgressBar1.Maximum = e.MaximumProgress
     ProgressBar1.Value = e.CurrentProgress
End Sub

the error reported is progressbar1.value should be between max and min e.currentprogress = -1 is not possible

+2  A: 

A value of -1 means "download has completed", as documented in the MSDN Library article for the property. Thus:

Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
  If e.CurrentProgress = -1 Then
     ProgressBar1.Maximum = 100
     ProgressBar1.Value = 100
  Else
     ProgressBar1.Maximum = e.MaximumProgress
     ProgressBar1.Value = e.CurrentProgress
  End If
End Sub

Or you might want to use -1 to hide the progress bar.

Hans Passant