CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    7

    Angry Progress bar Error!

    I am running c# 2010/.NET 4 Client Profile


    I have some code for my progress bar-statusProgress

    this code seems to do it's job, it displays the progress of my web browser control-webBrowser

    There is no error written, but when i load my app, it says:

    Value of '-1' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.
    Parameter name: Value

    Code is:

    private void webBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
    {
    statusProgress.Maximum = Convert.ToInt32(e.MaximumProgress);
    statusProgress.Value = Convert.ToInt32(e.CurrentProgress);
    }
    Please give some help!

  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Progress bar Error!

    from time to time you should take a look at msdn first ;]
    WebBrowserProgressChangedEventArgs.CurrentProgress Property
    Property Value
    The number of bytes that have been loaded or -1 to indicate that the download has completed.
    you have to handle this case properly
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #3
    Join Date
    Dec 2010
    Posts
    7

    Angry Re: Progress bar Error!

    i've already done that

    but it just has the same box- but with different values spawning indefinitely.


    Can you give some code that can ensure that the progress bar doesn't make an error!

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Progress bar Error!

    Quote Originally Posted by Jonathanwb View Post
    i've already done that

    but it just has the same box- but with different values spawning indefinitely.


    Can you give some code that can ensure that the progress bar doesn't make an error!
    No, we can't. Your original error is due to a value of -1 being returned and you not accounting for that possibility in your code. If you have a new problem then you will need to describe it for us.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured