求treeview与数据表相结合的实例
表能表示父子结点关系,能把增减节点后的数据保存在表中,结点层数不限制。谢谢 79429247@qq.com
[解决办法]
<玩转Treeview(及示例)>
http://download.csdn.net/source/1072523
[解决办法]
首先构造树结构表:如表名为“kjkm”,字段分别为“科目代码”,“科目名称”,“上级科目代码”
&& 加载树
if used("kjkm")==.f. use kjkm shared in 0 alias kjkmendifselect * from kjkm order by 科目代码 into cursor curKjkmselect curKjkmgo topscan nod=thisform.treeview1.nodes if empty(alltrim(curKjkm.上级科目代码))==.t. nod.add( , 1, alltrim(curKjkm.科目代码)+"_", alltrim(curKjkm.科目代码)+" "+alltrim(curKjkm.科目名称) ) else nod.add( alltrim(curKjkm.上级科目代码)+"_", 4, alltrim(curKjkm.科目代码)+"_", alltrim(curKjkm.科目代码)+" "+alltrim(curKjkm.科目名称) ) endifendscanuse in curKjkm