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. Image for the cookie policy date

GDI+ Exception in GridControl

I have got the following exception: ---------------- System.InvalidOperationException: The object is currently in use elsewhere. at System.Drawing.Graphics.EndContainer(GraphicsContainer container) at System.Windows.Forms.DibGraphicsBufferManager.ReleaseBuffer (GraphicsBuffer buffer) at System.Windows.Forms.GraphicsBuffer.Dispose() 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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ------------------------ during my research at the internet about such exceptions I had found that this is related to GDI+ double buffering. Is there any way to prevent such exceptions in future?? or do the latest Syncfusion versions cater this situation. I am using Syncfusion GridControl 1.6.x .

3 Replies

AD Administrator Syncfusion Team October 5, 2004 12:25 PM UTC

Are you using multiple threads? This can lead to objects in use problems if the threading is not being handled taken into account when accessing the grid object. Are you using or something earlier? Searching our Direct Trac incidents shows one occurrence of a similar exception, but that was more that a year ago before was released. You might want to try the release. If you can send me a sample that reproduces the problem, I can try it here.

MA Maqsood Ahmed October 6, 2004 04:12 AM UTC

I tried to reproduce this exception but it didn''t show up again. As for the multiple threading issue, I am doing all grid updates in the UI thread (using Invoke) so i think it is out of question. I am using

AD Administrator Syncfusion Team October 6, 2004 05:09 AM UTC

So just to confirm, before accessing the grid, you are calling grid.InvokeRequired to make sure you are on the grid''s thread. If you run your application on a multi-processor system, do the problems show up much more quickly? If so, this might be an indication that threading is playing a role in the problem. Unless you can send a sample, the best suggestion I have is to try your code with the latest release.

Live Chat Icon For mobile
Up arrow icon