We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Updating Grid from delegates throws exception

Thread ID:

Created:

Updated:

Platform:

Replies:

5962 Jul 25,2003 08:05 PM UTC Aug 14,2003 02:17 PM UTC WinForms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 25, 2003 08:05 PM UTC

Hi, I am updating grid data from several delegates implemented using BeginInvoke()/EndInvoke() framework. I got this exception. Can you shed some light on this? thanks, - Reddy ------------------------------------------- Unhandled Exception: System.InvalidProgramException: Grid is in updating mode at Syncfusion.Windows.Forms.Grid.GridControlBase.OnPaint(PaintEventArgs pe) 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 Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg) at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message& msg) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG& msg, HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at DBCopier.MainForm.Main() in c:\dev\dbcopier\dbcopier\mainform.cs:line 106The program '[3420] DBCopier.exe' has exited with code 0 (0x0).

Administrator [Syncfusion]
Replied On July 25, 2003 11:01 PM UTC

Are you using 1.6.1.4? If not, then there was some changes to make some static drawing member ThreadStatic after 1.6.1.1. This handled a problem one user was having trying to have multiple threads running with grids in each thread. Are you also checking grid.InvokeRequired before you access any grid properties, and if InvokeRequired returns true, lauching a new delegate on the grid's thread?

Jamie Hill
Replied On August 13, 2003 06:25 PM UTC

Is there somewhere I can get this version? I am also having the problem with the grid erroring out when in update mode. > Are you using 1.6.1.4? > > If not, then there was some changes to make some static drawing member ThreadStatic after 1.6.1.1. This handled a problem one user was having trying to have multiple threads running with grids in each thread. > > Are you also checking grid.InvokeRequired before you access any grid properties, and if InvokeRequired returns true, lauching a new delegate on the grid's thread? > >

Administrator [Syncfusion]
Replied On August 13, 2003 06:53 PM UTC

To get the update link, you should submit a Direct Trac support incident requesting it.

Jamie Hill
Replied On August 13, 2003 07:32 PM UTC

Better yet, could you give me an example of how to use the BeginInvoke to make my code more thread safe? > To get the update link, you should submit a Direct Trac support incident requesting it. >

Administrator [Syncfusion]
Replied On August 13, 2003 08:52 PM UTC

Here is a link to an article by Ian Griffiths. http://msdn.microsoft.com/msdnmag/issues/03/02/Multithreading/toc.asp At the bottom of this article are links to a couple of articles by Chris Sells that discuss using delegate invoking to handle multithreading in Windows Forms. Here is a little sample that illustrates how to use these ideas with a grid.

Administrator [Syncfusion]
Replied On August 14, 2003 01:12 PM UTC

Clay, I forgot to check the InvokeRequired flag. After I used that and made sure that I am updating grid on the gui thread, it worked fine. For some reason, it is not updating the current cell. Say, if my current cell is (1, 1) and start my (background) processing, the underlying data source (data table) is changed using a thread. The gui does not update (1, 1). Except that everything gets updated. If I move the current cell to someother cell, (1,1) cell is properly updated. Any pointers on how to fix it? thanks, - Reddy

Administrator [Syncfusion]
Replied On August 14, 2003 02:17 PM UTC

If you are calling RefreshRange to redraw the cells, in 1.6, there was a new overloaded RefreshRange method added that allows you to specify whether the currentcell should be updated. You might try using that overload.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;