I am trying to persist a treeview in an xml file. I have read a bit about serialization, and think that this is the way to go.

So I have coded in a form that contains the treeview the following:

Dim serialize As XmlSerializer
serialize = NewXmlSerializer(GetType(CustomTreeViews.clsModifiableTreeView))

serialize.Serialize(Console.Out, Me.TreeView1())
Console.Out.WriteLine()

In this code I am simply trying to generate the XML to the console - then I will tackle saving it in an XML file later. I am getting an Invalid Operation Exception error on the second line "There was an error reflecting
'CustomTreeViews.clsModifiableTreeView'." It also states that you cannot perform the operation on an Interface.

How can I serialize my treeview? I thought you could serialize any object?

Thanks in advance.