Hey folks
I'm attempting to track down an exception we're seeing using ultrawingrid with insert columns containing formulas.
The exception we're seeing ("System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection") is typically the result of a threading issue. I've verified that in our case we are not doing any threading ( so everything is on the UI thread).
This isn't our exact code, but theoreitcally should there be an issue with executing the following consecutively
1. Add unbound column to grid with a formula
2. Call ultracalcmanager.Recalc(-1)
3. Add column of the same key to the datatable bound to the grid (via ...table.Columns.Add())
4. Call ultracalcmanager.Recalc(-1)
Admittedly the order of these calls is a bit odd. But assume for the moment they have to be this way. It's my understanding that none of the above calls (note I'm calling recalc with the -1 parameter) should introduce any threading.
I know this isn't much to go on and very hypothetical, but is there anything I might be missing here?
Thanks,
Chris Rowland
I will admit this sequence of steps seems a bit odd, but for the sake of argument assume we have to follow this sequence.
I marked this as not the answer but you can consider this issue closed. More digging uncovered a problem on our part causing the exception we were seeing.
That being said I will admit I was disappointed when, after stating the caveat that "I know this is odd, but please ignore that for the moment and speak hypothetically" the answer is "this is very odd, why would you do this?"
For the record, what I posted (albeit in pseudo-code) does indeed work without incident and has been for a while (we started on Release 7 of the winforms components). I suspect there are other people besides us who have needed, for some business or user purpose, to work initially with an unbound column and later on "promote" it to bound. Maybe this will be helpful to those folks.
Hi Chris,
This series of steps is very odd. Why add an unbound column to the grid and then replace it with a bound column in the data source? Not only is that odd, I don't know what the grid will do in such a case. I would recommend that you avoid doing that if at all possible.
Other than that, I have no idea what could be causing the exception you are getting. It might help if you posted the call stack.