Set nodx = TreeView1.Nodes.Add(, , "r", "行业大类列表", 2)----这里是顶部
Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)----这里是下一级的节点
我已经循环从数据库中取出了这样的树状结构我现在的问题是Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)这里我循环取出了class的值之后怎么在这个节点下面增加他相应的子节点
数据库方面不用说。大家就告诉我一下怎么针对Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)这个代码能添加一个子节点就好了
谢谢大家。
Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)----这里是下一级的节点
我已经循环从数据库中取出了这样的树状结构我现在的问题是Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)这里我循环取出了class的值之后怎么在这个节点下面增加他相应的子节点
数据库方面不用说。大家就告诉我一下怎么针对Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)这个代码能添加一个子节点就好了
谢谢大家。
这段代码是不是也在for循环中?
这样子就不行了!~
思路我还知道也
我现在就是不知道怎么给Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)这个节点增加子节点明白不?
DO WHILE RS.EOF
Set nodx = TreeView1.Nodes.Add("class", tvwChild, ,RS.FIELD(0) , 1)
RS.MOVENEXT
NEXT
我的方法是
Set nodx = TreeView1.Nodes.Add(, , "r", "行业大类列表", 2)
y=0
do while not rs.eof
Set nodx = TreeView1.Nodes.Add(TreeView1.Nodes.count-y, tvwChild, , rs.Fields("class"), 1)
y=y+1
loop这个方法只能在一个父Node加好后马上加他的子nodes如果你的层数很多的话要注意控制好数字,反正添加的总是最后一个算法解决好了就很简单
nodx.Key = "string as you will"
Set nodx = TreeView1.Nodes.Add("string as you will", tvwChild, , "新值", 1)
TreeView1.ImageList = ImageList1
Dim nodx As Node 'treeview的节点对象
Dim nodx2 As Node
Set nodx = TreeView1.Nodes.Add(, , "r", "行业大类列表", 2)
tree_sql = "select class from CusTomer_Aclass order by id desc"
Set mrc = ExecuteSQL(tree_sql, MsgText)
If mrc.EOF Then
Set nodx = TreeView1.Nodes.Add("r", tvwChild, , "当前还没有行业大类资料", 1)
Else mrc.MoveFirst
Do While Not mrc.EOF
AClass = mrc.Fields("class")
Set nodx = TreeView1.Nodes.Add("r", tvwChild, , mrc.Fields("class"), 1)
nodx.Key = "string as you will"
Set nodx = TreeView1.Nodes.Add("string as you will", tvwChild, , "新值", 1)
mrc.MoveNext
Loop
End If
mrc.Close
TreeView1.Nodes(1).Expanded = True
nodx.Key = "string as you will"
Set nodx = TreeView1.Nodes.Add("string as you will", tvwChild, , "新值", 1)这里就说键值不唯一
Set nd = TreeView1.Nodes.Add("ppl0key000", tvwChild, "p0l1key", "漳州")
Set nd = TreeView1.Nodes.Add("ppl0key000", tvwChild, "p0l1keyA", "漳州AA")
Set nd = TreeView1.Nodes.Add("p0l1keyA", tvwChild, "p0l1keyNNN", "高兴")