Treeview troubles

D

David

I am running VB.Net 2005.

Currently I am experiencing problems saving and loading a Treeview to file.

I am using Text, Key and ImageIndex in the treeview nodes.

When I save the treeview to file and reload it, I loose the key value
and can only retrieve Text and Imageindex.

Does anyone here have an example that can save and load all values of
the treenode ?

The documentation I have found is a bit confusing as it refers to this
Key field also as TAG and in other cases NAME ?

Thanks in advance

Regards

David
 
P

Phill W.

David said:
I am running VB.Net 2005.
Currently I am experiencing problems saving and loading a Treeview to file.

I am using Text, Key and ImageIndex in the treeview nodes.

I'm still using '2003, but has the '2005 TreeView /regained/ its Keys?
They disappeared in the jump from VB "Proper" to VB.Net.
When I save the treeview to file and reload it, I loose the key value
and can only retrieve Text and Imageindex.
Does anyone here have an example that can save and load all values of
the treenode ?

Depends how you want them saved - :) - but your code needs to be
recursive, /something/ like:

Function SaveTree( ByVal oFirst As TreeNode )
Do While oFirst IsNot Nothing

SaveNode( oFirst )

If oFirst.Nodes.Count > 0 Then
SaveTree( oFirst.Nodes(0) )
End if

oFirst = oFirst.Next'Node?
Loop
End Function

HTH,
Phill W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top