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
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTree; private void button3_Click(object sender, System.EventArgs e) { // The following code will save the state of the tree // into a file in XML format this.ultraTree1.SaveAsXml( "tree.xml" ); // The following code will save the state of the tree // into a file in binary format this.ultraTree1.SaveAsBinary( "tree.dat" ); System.IO.MemoryStream stream = new System.IO.MemoryStream(); // The following code will save the state of the tree // into a stream (in this case a memory stream) in binary format this.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. this.ultraTree1.LoadFromBinary( stream ); // Note: The SaveAsXml and LoadFromXml methods also have // overloads that take a stream. } private void button4_Click(object sender, System.EventArgs e) { // The following code will load the state of the tree // from a previously saved XML format file. this.ultraTree1.LoadFromXml( "tree.xml" ); // The following code will load the state of the tree // from a previously saved binary format file. this.ultraTree1.LoadFromBinary( "tree.dat" ); }