Hunter
2015-04-18T17:22:37Z
Hello! I make
iGRow dr = iGrid_Quote.Rows.Add();
in new Thread C# (NET 4.5)

This does not work. Help!

Error
System.InvalidOperationException не обработано
  _HResult=-2146233079
  _message=Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.
  HResult=-2146233079
  IsTransient=false
  Message=Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.
  Source=System.Windows.Forms
  StackTrace:
       at System.Windows.Forms.Control.get_Handle()
       at System.Windows.Forms.Control.get_InternalHandle()
       at System.Windows.Forms.Control.get_CreateParams()
       at TenTec.Windows.iGridLib.iGScrollBarBase.get_CreateParams()
       at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
       at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
       at System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
       at System.Windows.Forms.Control.set_Top(Int32 value)
       at TenTec.Windows.iGridLib.iGrid.SetVScrollBarVisibility(Boolean vScrollBarVisible, Boolean hScrollBarVisible, Int32 scrollableRowsHeight, Int32 scrollableAreaHeight, Int32 borderSize)
       at TenTec.Windows.iGridLib.iGrid.AdjustScrollBars()
       at TenTec.Windows.iGridLib.iGrid.AddRowRange(Int32 rowBefore, Int32 count, iGRowData rowData, Boolean checkGroupAndSortParams)
       at TenTec.Windows.iGridLib.iGrid.AddRowRange(Int32 rowBefore, Int32 count)
       at TenTec.Windows.iGridLib.iGRowCollection.Add()
       at ST_client.wQuote.iGrid_Quote_AddNewRow() in c:\STape\ST_client\ST_client\wQuote.xaml.cs:line 233
       at ST_client.wQuote.work_message_quote() in c:\STape\ST_client\ST_client\wQuote.xaml.cs:line 394
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
Igor/10Tec
2015-04-20T09:02:58Z
Sure you may encounter problems like this as iGrid.NET is not a multithreaded control. It's a common problem for all WinForms controls, which are not thread safety.

However, it is possible to use iGrid in multithreaded apps, and we demonstrate how you can update iGrid from a separate thread in the Multithreading sample in the demo. Find it in the Ideas for Your Apps sample group.