User (Old forums)MemberApril 3, 2008 at 6:31 amPost count: 23064
I’ve got a read-only gridControl bound to a DataTable which is changed by another thread. Everything worked like a charm, until I changed the code for the DataTable update and added a second Select() and a for loop that changes the rows of the DataTable. The gridControl starts to flicker, sometimes a red X appears instead of the grid and a TargetInvocationException occurs. I suspect this is a threading issue. How can I fix it?
Thanks a lot
Xceed Component Version 2.2.6415.0
Following the code that makes the update to the DataTable:
Boolean caseSensivity = secTable.CaseSensitive;
secTable.CaseSensitive = true;
DataRow rows = secTable.Select(“[Currency]='” + currency + “‘”);
Debug.WriteLine(“Changing currency=” + currency + ” in ” + rows.Length + ” rows of table=” + tableName);
for (int i = 0; i < rows.Length; i++)
rows[i][“EUR rate”] = value;
//The following select and the for loop causes the trouble:
DataRow orows = secTable.Select(“[Currency]='” + pence_currency + “‘”);
Debug.WriteLine(“Changing pence_currency=” + pence_currency + ” in ” + orows.Length + ” rows of table=” + tableName);
for (int i = 0; i < orows.Length; i++)
orows[i][“EUR rate”] = (value / 100);
secTable.CaseSensitive = caseSensivity;
Imported from legacy forums. Posted by twi (had 4868 views)User (Old forums)MemberApril 3, 2008 at 11:15 amPost count: 23064
Just tried the latest version of the xceed components but the grid still flickers and throws another exception message:
************** Exception Text **************
System.InvalidOperationException: An attempt was made to create a cell when its parent row is not part of a grid.
at Xceed.Grid.Collections.CellList.CreateItemFromTemplate(Int32 index)
at Xceed.Grid.Collections.VirtualListBase.GetVirtualItem(Int32 index, Boolean& isWeakReferenced)
at Xceed.Grid.Collections.VirtualListBase.GetVirtualItem(Int32 index)
at Xceed.Grid.Collections.VirtualListBase.ListGetItem(Int32 index)
at Xceed.Grid.Collections.CellList.get_Item(Int32 index)
at Xceed.Grid.PaintManager.PaintVisibleRows(VisibleRowList visibleRows, PaintEventArgs e)
at Xceed.Grid.PaintManager.PaintGrid(PaintEventArgs e)
at Xceed.Grid.GridControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Xceed.Grid.GridControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Imported from legacy forums. Posted by twi (had 596 views)Xceed SupportMemberApril 4, 2008 at 3:11 pmPost count: 5658
We tried reproducing this and were not able to. We might be missing some of the important parameters to reproduce the issue.
Could you send us (at <a href=”mailto:email@example.com”>support</a>) a sample application that reproduces the issue? It would greatly help us to investigate the issue.
Imported from legacy forums. Posted by CharlesB (had 3442 views)User (Old forums)MemberMay 7, 2009 at 10:33 amPost count: 23064
Has this issue been solved? I’m experiencing more or less the same problem. It’s very hard to reproduce and only happens sometimes (race condition?).
The grids in my app usually runs smoothly, but sometimes I’m getting the following 2 errors (probably related):
– Object reference not set to an instance of an object. Happens occasionally when calling the line
System.Type type = c.ParentColumn.DataType;
where c is of type Xceed.Grid.Cell and definitely not null, so it must be the ParentColumn that is null
– An attempt was made to create a cell when its parent row is not part of a grid (same trace as above). This one happens sometimes when calling the line
row.Cells[ m_colKeyIndex ]).Value;
where row is of type Xceed.Grid.DataRow.
I hope you can help me out!
Imported from legacy forums. Posted by ronny (had 1940 views)User (Old forums)MemberMay 8, 2009 at 11:22 amPost count: 23064
We did not receive the other user’s application, so we did not investigate this further.
Is your application multi-threaded? If so, it is possible it is a race condition, but not necessarily due to the grid. You would need to investigate this further on your side.
It is difficult to provide more feedback without an application reproducing the issue.
Imported from legacy forums. Posted by André (had 2796 views)
- You must be logged in to reply to this topic.