By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

how to swap two nodes of a treeview

P: n/a
Sam
Hi,
How can I swap positions and values of two nodes in a treeview ?

Thx

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Sam,

Treenode has a collection, TreeNodeCollection (would you believe! :-). This
collection class has an item property that takes an index. So, yes it should
be pretty simple as long as you know the indices or relative indices!

HTH, Phil
"Sam" <sa**************@voila.fr> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,
How can I swap positions and values of two nodes in a treeview ?

Thx

Nov 21 '05 #2

P: n/a
Sam
Hi Phil,
So, yes it should be pretty simple

I wish it was:-)

I can swap the text of two nodes no problem, which means my indexes are
correct at least. However when I swap the nodes, there is no effect at
all :

Dim n1 As TreeNode = FindControlNode(CType(obj1, Field))
Dim n2 As TreeNode = FindControlNode(CType(obj2, Field))

Dim tmp As TreeNode = n1
n1 = n2
n2 = tmp

Can you help?

Nov 21 '05 #3

P: n/a
Sam
I 've solved the problem by doing series of RemoveAt and Insert :)

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.