Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

action being performed on this control is being called from the wrong thread c#

public delegate void FunctionDelegate();

treeViewControl.BeginInvoke(new FunctionDelegate(TreeViewBug));

private void TreeViewBug() {
	Random rand = new Random();
    TreeNode node = treeViewControl.Nodes.Add("Parent");

	for (int i = 0 ; i < 10000 ; i++ ) // some kind of long operation
        node.Nodes.Add(rand.Next().ToString());
}
 
PREVIOUS NEXT
Tagged: #action #performed #control #called #wrong #thread
ADD COMMENT
Topic
Name
6+1 =