On http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx one finds some good advises on how to use Dotnet's DataGridView with large data. Amongst others one is told to care about Shared Row for data reuse.
A solution of mine was to populate the grid with objects of my own creation and then call SetValues; but when I refactored my solution and put the calls in the "right place" I got an InvalidOperationException exception with the message "Operation cannot be performed on a shared row."
The SetValues call was made from a class that inherited DataGridViewRow. The solution was to move the call out of the class (to my class that inherited the UserControl).
This article might hopefully help someone in the future with the same problem.
1 comment:
Thanks for the link to the MS articles.. very helpful. I was getting this error on a custom DataGridView of my own.
In my case, my custom DataGridViewRowCollection, which was executing a specialized AddCustomRow() method, works flawlessly if the custom DataGridView was visible. I only got the error once I put the grid onto a secondary TabPage control.. in other words, I get the error when trying to add rows to the custom control if it's not yet visible.
Post a Comment