Introduction
This is a class named LoadAndSave
in the jhTreeViewTools
namespace. I wrote it, because I needed to save and load the content of a TreeView
in correct order including the Tag
s of each node. And I wanted to use serialization for that.
This is why I strongly required that there is nothing stored in the Node.Tag
that isn't serializable because this will cause an error message. I am serializing the whole root-nodes, so everything that is stored in that Node
and its children will be saved. I am still wondering why the ToolTip-text is not saved although it's also part of a Node
!?
Details
There are only two public methods:
public static int saveTree(TreeView tree, string filename)
public static int loadTree(TreeView tree, string filename)
With those you can save and load the contents only by giving the TreeView
control and the file name as arguments.
I use this class in my application in mostly the same way but I changed the main-descriptions of each method to the English language. The rest of the code-comments are in German because I haven't got the time to translate everything. Please try it and if there is anything that I may change or if you find mistakes in my code, please email me. Remind yourself that I am a C# beginner!
I am programming more or less since I was 15 years.
It started with BASIC and during school I did
a lot Pascal programs for MS DOS.
After that I came to visual Windows programming and coded a lot in Delphi and later in C# .NET.
I made also some excursions in C and C++.
I also like Perl, Python and other scripting languages.
After a long break not programming anything, the last approx. 5-6 years I am only working with Java and SQL.
New for me is Objective-C - I am starting to get involved into Mac Programming