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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid and Threads

Thread ID:





6287 Aug 7,2003 12:31 PM UTC Aug 7,2003 02:52 PM UTC WinForms 1
Tags: GridControl
Randy Kennison
Asked On August 7, 2003 12:31 PM UTC

What support is included in the grid controls for threading? Here is my siduation... Main app starts up.. kicks off a thread and opens document_01. That thread then, via events, sends messages back to the document, which then updates the display of values on that documents form, one item on that form is a grid ( happens with both databound and normal grids ). Now... If a user were to double click on a column heading let's say, while the event is being processed ( the event just sends data along that needs to be added/changed/deleted from teh grid ), things get really odd. Typicall, the program will begin throwing excpetions, sometimes ( based on luck of the draw i'm guessing ), it all works fine. Some of the excpetions include... Row invalid index, Col invalid index...etc. Any help in locking this thing down to support MT apps would be nice. Anyone else had to deal with this? ( App is in C# )

Administrator [Syncfusion]
Replied On August 7, 2003 02:52 PM UTC

As with most Windows Forms Controls, instance members of GridControl are not thread-safe. Any interaction with the grid *must* be done on the thread that created the grid. You have to protect calls into the grid with grid.InvokeRequired checks, and it necessary, launch a delegate on the grid's thread with grid.Invoke. You have to use InvokeRequired on a method by method basis. Anytime you access the grid within a method that *might* have been called from the non-UI thread, you must use grid.InvokeRequired to test whether this call is coming in on the grid thread. If not, then you must call grid.Invoke on a new delegate to force the call to be on the UI thread. Here is a little sample that illustrates how to handle this problem. Here is a link to a MSDN article by Ian Griffiths on this problem. At the bottom of this article are two links to earlier articles by Chris Sells that are a good read.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon