when execute application, following error occurs:
system.argumentoutofrangeexception unhandled user code. specified argument out of range of valid values. parameter name: index
the error occurs on line below commented:
private void helper_generalsummary(gridviewrow row) { double holdingdays = convert.todouble(row.cells[6].text); double absreturn = convert.todouble(row.cells[7].text); double annreturn = (absreturn / holdingdays) * 365; row.cells[8].text = annreturn.tostring("#,0.00"); //error occured }
an argumentoutofrangeexception means have provided value, big or small doing. in particular example you're trying access contents of array:
row.cells[8].text = annreturn.tostring("#,0.00"); you can ignore of line, error occuring in section:
row.cells[8] it's telling cells array, not have 9 columns. bear in mind 0-indexed, index of 8 means access column 9. conversely access first column use row.cells[0].
you've therefore made bad assumption somewhere , need check data you've got out system first. if stick breakpoint on line should able dig row.cells see columns you've got work with.
Comments
Post a Comment