class tree { public string id; public string nodetext; public string parentid; }
class totreeview { arraylist datas; system.collections.hashtable treenodes; public void totree(system.windows.forms.treeview tv) { foreach(tree t in datas) { if(this.treenodes.containskey(t.parentid)) { system.windows.forms.treenode tn = (system.windows.forms.treenode)this.treenodes[t.parentid]; system.windows.forms.treenode addtn = new system.windows.forms.treenode(t.nodetext); tn.nodes.add(addtn); this.treenodes.add(t.id,addtn); } } } }