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

InvokeRequired on Diagram Model

Thread ID:





95386 Jul 5,2010 03:22 PM UTC Jul 13,2010 12:06 PM UTC WinForms 3
Tags: Diagram
Mathieu Audet
Asked On July 5, 2010 03:22 PM UTC


I am trying to add node to a diagram inside a thread and it always crashes each time I call the MyDiagram.Model.AnyPropertyOrMethod because there is not a MyDiagram.Model.InvokeRequired that I can use to map a delegate function.

Any suggestions to add a node to a diagram inside a Thread?


Jaffersathick B [Syncfusion]
Replied On July 6, 2010 06:10 AM UTC

Hi Mathieu Audet,

Thank you for your interest in Syncfusion products.

We suggest you to use the “BackgroundWorker” thread to add the node. Please refer the following code snippet:

private void button1_Click(object sender, EventArgs e)
void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
Syncfusion.Windows.Forms.Diagram.Rectangle rec = new Syncfusion.Windows.Forms.Diagram.Rectangle(10, 10, 100, 100);
rec.EditStyle.AllowDelete = false;

Please refer the following msdn link:


Let me know if it helps.


Mathieu Audet
Replied On July 6, 2010 05:32 PM UTC

Hi Jaffer,

In fact I am already using a background worker. In my backgroundWorker1_DoWork() function, I use the following code to add the node:

if (myDiagram.InvokeRequired)
AddNodeDelegate delegateMethod = new AddNodeDelegate(AddNode);

private void AddNode()
myDiagram.Model.AppendChild(some Node);

But since the myDiagram.Model doesn't have a .InvokeRequired property, it always crashes. I was wondering if there was a workaround to this, because when the backgroundWorker1_RunWorkerCompleted event is fired, the Thread created by the background worker doesn't exist anymore and the main thread retakes the execution, so the code executed inside this bracket is executed by the main thread.

Any solutions?

Thanks in advance


Jaffersathick B [Syncfusion]
Replied On July 13, 2010 12:06 PM UTC

Hi Mathieu,

Sorry for the delay in getting back to you.

We tried the reported issue with in the “RunWorkerCompleted” but the reported issue does not occur. could you try reproducing it in a simple sample and send us the modified sample, so that we could sort out the cause of the issue and provide you a solution.



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