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

Grid and Threads

Thread ID:

Created:

Updated:

Platform:

Replies:

6287 Aug 7,2003 08:31 AM Aug 7,2003 10:52 AM Windows Forms 1
loading
Tags: GridControl
Randy Kennison
Asked On August 7, 2003 08:31 AM

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 10:52 AM

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.

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.

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.

;