S
Steven
Hi,
I have created my own node (class MyNode : TreeNode) for a TreeView.
To populate the treeview, i use something like MyNode newNode = new
MyNode("Bla bla bla","0","1") for example.
But, to move the nodes in the treeview, i use the clone() method... :
MyNode theCopy = (MyNode)theTreeView.SelectedNode.Clone();
int leIndex = theTreeView.SelectedNode.Index;
MyNode theParent = (MyNode)theTreeView.SelectedNode.Parent;
theTreeView.Nodes.Remove(theTreeView.SelectedNode);
if (theParent == null) theTreeView.Nodes.Insert(leIndex - 1, theCopy );
else theParent .Nodes.Insert(leIndex - 1, theCopy );
theTreeView.SelectedNode = theCopie;
.... and then i lose all my MyNode specific parameters.
I guess that it's because i use the Clone method of the TreeNode part of my
MyNode class.
I think i should override the Clone method in MyNode class, but i don't know
how to do this.
If you have any suggestion... Thanks !
FB.
I have created my own node (class MyNode : TreeNode) for a TreeView.
To populate the treeview, i use something like MyNode newNode = new
MyNode("Bla bla bla","0","1") for example.
But, to move the nodes in the treeview, i use the clone() method... :
MyNode theCopy = (MyNode)theTreeView.SelectedNode.Clone();
int leIndex = theTreeView.SelectedNode.Index;
MyNode theParent = (MyNode)theTreeView.SelectedNode.Parent;
theTreeView.Nodes.Remove(theTreeView.SelectedNode);
if (theParent == null) theTreeView.Nodes.Insert(leIndex - 1, theCopy );
else theParent .Nodes.Insert(leIndex - 1, theCopy );
theTreeView.SelectedNode = theCopie;
.... and then i lose all my MyNode specific parameters.
I guess that it's because i use the Clone method of the TreeNode part of my
MyNode class.
I think i should override the Clone method in MyNode class, but i don't know
how to do this.
If you have any suggestion... Thanks !
FB.