Treeview troubles

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    #1

    Treeview troubles

    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
  • Phill W.

    #2
    Re: Treeview troubles

    David wrote:
    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.Co unt 0 Then
    SaveTree( oFirst.Nodes(0) )
    End if

    oFirst = oFirst.Next'Nod e?
    Loop
    End Function

    HTH,
    Phill W.

    Comment

    Working...