We help IT Professionals succeed at work.

'0' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'.

etmendz asked
Last Modified: 2012-05-04
I am using .Net Framework 1.1 WinForms DataGrid.

Everytime I refresh the DataGrid, I get the error "'0' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'." especially when the query result is empty. What does this mean and how can I prevent it? Is this a bug in .Net?

Here's my VB.Net code:

                da.Fill(ds, "Monitor")
                dg.SetDataBinding(ds, "Monitor")

da is my DataAdapter. ds is a global variable of type DataSet. dg is my DataGrid. I initialize and bind ds to dg on Form load (using SetDataBinding()). The code above is how I refresh dg.

What causes the error "'0' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'." and is there a way to prevent it from happening?

On the side: Is there a better way of refreshing my DataGrid without having to call SetDataBinding() again?

Thank you in advance.
Watch Question

Most Valuable Expert 2012
Top Expert 2008

How is the data grid initialized and configured?  Did you create an inherited control?  VB.NET or ASP.NET?  2002 or 2003?  Are you using any scroll bar controls?
Do you use ErrorProviders? If yes check the validation values
also try to change
    da.Fill(ds, "Monitor")
    dg.SetDataBinding(ds, "Monitor")


    da.Fill(ds, "Monitor")
    dg.DataSource = ds.Tables("Monitor")
I assume that Monitor is your table


Sorry I never got back to this sooner. Got stuck with other tasks. But I'm back with this problem (still)...

I used the DataGrid as is straight from the Toolbox.

This error happens only when my application is not the active window. If I keep my application window active, the error is never encountered.



I found a Microsoft article (I lost the URL) that said this is a known bug in the .Net Framework 1.0. It seems that it is still a problem in the .Net Framework 1.1. Or maybe not? I currently have both versions. I have configured my application to use 1.1.

Summarily, here's the situation:
* I fetch data from an SQL Server 2000 database.
* My DataGrid works well. I refresh my DataGrid on a regular basis (every 3 minutes) which works well , too.
* The error does not happen when the application is the active window.
* The error is encountered when the application is not the active window.
* I noticed that the error I reported here happens especially when the refresh results to an empty query result set.
* If the application window is left inactive for a long time (overnight), the DataGrid may itself becomes "dead" (does not refresh at all even if query results are expected; does not report errors). You'll need to restart the entire application to make it work again. This is intermittent but it happened.

I'd really appreciate if anyone can point me to a direction that completely solves this problem. The application in question cannot always be the active window in the server it is running. If it's a .Net bug (forever), an article that officially states so is appreciated.

Thanks in advance.
This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.