The Multi-Select Treeview 2 control is not thread safe. Try rapidly double clicking between nodes while the LabelEdit attribute is set to true.
System.InvalidOperationException was unhandled
Message=Cross-thread operation not valid: Control 'treeview2' accessed from a thread other than the thread it was created on.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, IntPtr lparam)
at System.Windows.Forms.TreeView.set_SelectedNode(TreeNode value)
at CodersLab.Windows.Controls.TreeView.TreeView.set_SelectedNode(TreeNode value) in C:\Users\user\Desktop\multi-select-TreeView\multi-select-TreeView\TreeView.cs:line 167
at CodersLab.Windows.Controls.TreeView.TreeView.StartEdit(Object state) in C:\Users\user\Desktop\multi-select-TreeView\multi-select-TreeView\TreeView.cs:line 1260
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
InnerException:
I had this problem too and found a way to fix it without big work. But I'm not sure if there aren't any more bugs like this.
Anyway... This is my solution for this poblem.
There's a method 'StartEdit()' in the same region as 'FlashNode()' in TreeView.cs. The only thing to do is adding following code at the beginning of the method 'StartEdit()':
----
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(delegate
{
StartEdit();
}));
return;
}
----
very simple but it works ;)