Office中国论坛/Access中国论坛

标题: [求助]treeview增加“爷”节点 [打印本页]

作者: lovehere    时间: 2010-3-24 11:39
标题: [求助]treeview增加“爷”节点
从坛子里下载了“三小时掌握TREEVIEW控件”的例子,很好很强大,但有了新问题,不知道如何增加“爷”节点?是否只能有一个“爷”节点吗?我把我学者做的例子传上来,向高手们请教一下,在目前的例子中如何增加。
作者: aslxt    时间: 2010-3-24 11:53
例如:
Set nodindex = TreeView.Nodes.Add(, , "A", "人员")
作者: lovehere    时间: 2010-3-24 12:23
多谢楼上回复,在附件中尝试这样加过,但提示:集合中的关键字不唯一!
作者: aslxt    时间: 2010-3-24 12:37
'设置最顶级的"爷"
'* ---------------------------
    Set nodindex = TreeView.Nodes.Add(, , "爷", "省份", "K1", "K2")
    nodindex.Sorted = True
    Set nodindex = TreeView.Nodes.Add(, , "爷1", "人员", "K1", "K2")
    nodindex.Sorted = True
'* -----------------------------------------------------------------

注意,"爷"和"爷1"的区别,他们是关键字,不能有重复!,你可以在附件中自己添加有"爷1"以及之后的两行测试一下
作者: lovehere    时间: 2010-3-24 12:54
这个搞定了,
我在“父”一级想把人员表中的姓名加进来,却又不行了,帮看看

    '设置第二级"父"
'* ---------------------------
    Rec.Open "地区表", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    For i = 0 To Rec.RecordCount - 1
        Set nodindex = TreeView.Nodes.Add("爷", tvwChild, "父" & Rec.Fields("地区编号"), Rec.Fields("省市名称"), "K1", "K2")
        nodindex.Sorted = True
        Rec.MoveNext
   
    Next
      
    Rec.Close
   
       Rec.Open "人员名单", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    For i = 0 To Rec.RecordCount - 1
        Set nodindex = TreeView.Nodes.Add("爷1", tvwChild, "父1" & Rec.Fields("编号"), Rec.Fields("姓名"), "K1", "K2")
        nodindex.Sorted = True
        Rec.MoveNext
   
    Next
      
    Rec.Close
作者: kkh680    时间: 2010-6-13 22:47
sdsdsdsdsdsdsdsd
作者: wux0707    时间: 2010-11-4 23:28





欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3