We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Serialize/Deserialize TreeView

I have successfully serialized a treeview to an xml file like so: Dim formatter = New SoapFormatter() Try Dim stream = New FileStream("mytree.xml", FileMode.Create, FileAccess.Write, FileShare.None) Dim root As New TreeNode() Dim node As TreeNode For Each node In TreeView1.Nodes root.Nodes.Add(CType(node.Clone(), TreeNode)) Next node formatter.Serialize(stream, root) stream.Close() Catch ec As Exception MsgBox("Exception at " + ec.TargetSite.Name + ": " + ec.Message) End Try ... I can not however figure out how to deserialize the xml file and re-populate my treeview. I have looked at this url: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q308063 But haven't found any workable solution. Hasn't someone else ran into this before? Any help would be greatly appreciated. Patrick

3 Replies

AD Administrator Syncfusion Team April 19, 2004 06:28 PM UTC

I am having same issue. Anyone have a solution?

AD Administrator Syncfusion Team April 21, 2004 02:02 PM UTC

Hi Patrick, We do have the AppStateSerializer''s SerializeObject/DeserializeObject methods to save/load any control state information on a form. Please refer to the sample in the directory ....\Syncfusion\Essential Suite\\Shared\Samples\AppStateSerializerDemo which shows how to do this on a TextBox. This can be adapted for the TreeViewAdv as well. Let me know what information regarding the TreeViewAdv do you wish to persist here ? Is it just the collapsed/expanded state information or is there anything else that you wish to persist ? We appreciate your cooperation, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

KH Karen Handelmann February 2, 2005 09:27 AM UTC

I tried to serialize the nodes of a TreeViewAdv.root object and it does not work. Do I have to scan the whole node-hierachie and serialize each TreeNodeAdv itself?

Live Chat Icon For mobile
Up arrow icon