i have a event handler that moves the selected treenode up. I don't know why is crash in the line with comented. treeviewdocxml is a treeview object, from System.Windows.Forms
treeViewDocXml.BeginUpdate();
TreeNode sourceNode = treeViewDocXml.SelectedNode;
if (sourceNode.Parent == null)
{
return;
}
if (sourceNode.Index > 0)
{
sourceNode.Parent.Nodes.Remove(sourceNode);
sourceNode.Parent.Nodes.Insert(sourceNode.Index - 1, sourceNode); //HERE CRASH
}
treeViewDocXml.EndUpdate();