Click here to Skip to main content
16,017,899 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index . I got this error when I was selecting last row on gridview to update the data
Posted
Comments
Jim Meadors 18-Nov-14 1:27am    
If you are using Count in accessing your data, subtract 1 to convert it to Index.

1 solution

This case is probably the simplest for debugging. Run it under the debugger and locate the line where the exception is thrown. If will show the line where you access something by index. Expect its value.

That's all.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900