"The ContentLength property contains the value of the Content-Length header returned with the response. If the Content-Length header is not set in the response, ContentLength is set to the value -1."
From the error you are getting, I would say the above applies to:
ProgressBar1.Maximum =...