Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTree
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    ' The following code will save the state of the tree
    ' into a file in XML format
    Me.ultraTree1.SaveAsXml("tree.xml")
    ' The following code will save the state of the tree
    ' into a file in binary format
    Me.ultraTree1.SaveAsBinary("tree.dat")
    Dim stream As New System.IO.MemoryStream()
    ' The following code will save the state of the tree
    ' into a stream (in Me case a memory stream) in binary format
    Me.ultraTree1.SaveAsBinary(stream)
    ' Note: Before calling the LoadFromBinary on the memory
    '       stream created above, we need to reset its position
    '       back to 0.
    stream.Position = 0
    ' The following code will re-load the state of the tree
    ' from the memory stream.
    Me.ultraTree1.LoadFromBinary(stream)
    ' Note: The SaveAsXml and LoadFromXml methods also have
    '       overloads that take a stream.
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    ' The following code will load the state of the tree
    ' from a previously saved XML format file. 
    Me.ultraTree1.LoadFromXml("tree.xml")
    ' The following code will load the state of the tree
    ' from a previously saved binary format file. 
    Me.ultraTree1.LoadFromBinary("tree.dat")
End Sub