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

C#
1

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());
}
Posted by: Guest on January-14-2022

Code answers related to "action being performed on this control is being called from the wrong thread c#"

C# Answers by Framework

Browse Popular Code Answers by Language