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

Can a GridControl be used in a multithreaded application?

Platform: WinForms |
Control: GridControl |
Published Date: April 30, 2011 |
Last Revised Date: February 12, 2015
Tags: threading

 

Solution

Like the most Windows Forms controls, the GridControl can be used in multithreaded applications as long as you use the Invoke/InvokeRequired techniques to make sure that all the interactions with the Grid is done on the thread that created it.

The requirement for using multiple threads is that every UI control must interact with the UI thread that created it. The simple way to do this is to use InvokeRequired to test whether you are on the wrong thread.

So, anytime you access the Grid from within a method that may have been called from the non-UI thread, you must use the grid.InvokeRequired to test whether this call is coming on the UI thread. If not, then you must call grid.Invoke on a new delegate to force the call to be on the UI thread.

There is a couple of articles on MSDN online by Chris Sells that discusses this problem. Here is a link to an article by Ian Griffiths that discusses these problems and also provides links to the Sells articles.

You can refer to the attached sample that illustrates how to use these ideas with the Grid.

http://www.syncfusion.com/downloads/support/directtrac/general/WF-14491_Threading_sample_in_GridControl621206258.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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