Hello,
we have an application which uses a WinGrid with 3 bands.
On the second band we have 3 columns: Suppliers, Quantities and a third colum which uses a MultiSelect UltraCombo with the list of Orders for that supplier. After selecting the Orders by checking them on the UltraCombo it adds new rows to a third band listing the orders I choosed.
First time it works like a charm! On the BeforeCellListDropDown event I load all the orders for that specific supplier and there's no Errors.
When I pass on to another supplier it throws an Unhandled Exception like on the picture attached. The exception window appears after the BeforeCellListDropDown and not always... but 90% of the time...
It doesn't happen if I select the rows in the combo in order (from top of the list to bottom) as long as I select the first item on the list... everything else throws this error...
What could be wrong?
Please help because this project is due to deliver this week!
Many thanks.
Hi,
Sorry, I misunderstood what you said about removing and adding the EditorComponent. That's clearly not a good solution, even if solves the issue.
Having said that, there's clearly a whole lot of other stuff going on there, and I'm afraid I do not have a magic solution for you. If you can reproduce the issue in a small sample project I will be happy to take a look at it and tell you what's happening and why the exception is occurring. But without being able to see it, all I can do is make some wild guesses.
If the problem is being caused by the fact that you are adding rows to a child band when selecting items from the list, then maybe you can get around that by using a BeginInvoke instead of adding the rows directly inside the event handler.
Spoken to soon...
I still got the scroll problem... how CAN I SOLVE THIS?????
I don't want to give bad luck but... I think I solved it!
Apparentely the problem is that I was adding the rows on the third band directly from this:
For each loRow as UltraGridRow in cmbOrders.CheckedRows
' AddRows Code
Next
After a debug I found that sometimes th cmbOrders "lost" the CheckedRows reference returning Null and causinh these problems...
So now before I add any rows to the third band, I save the values on a temporary table and after the table is populated, I run thru the temp table rows and add the rows to the third band..
I already did 4 tests with variations and the error didn't occur anymore... I will make more tests today and tomorrow and get back here to confirm if this REALLY solved it!
I remove and add the EditorComponent exactly to solve THIS PROBLEM. I'm using EditorComponent instead of ValueList because with ValueList the combo closes without letting me select any row...
Besides I already tried your advise (I just add the EditorComponent once when the form is loading) and I still got the same problem...
Okay, it seems like you are jumping through some serious hoops here. Why do you need to remove the EditorComponent from the cell? I suspect that is what is causing the problem. The grid is trying to find something on the ValueList and it's not there and the grid is not expecting it to be gone, since it was in the middle of processing the selection of an item.
This could be considered a bug in the grid - the grid should probably not be assuming that the ValueList is still there. That's something we could fix if we could duplicate the problem.
But it seems like your code might be doing some odd things here and it might be better in the long run for you to simplify it so that you avoid removing and re-adding the EditorComponent.