请教如何判断treeview里的根数量,谢谢!!!!

yqy888 2003-09-03 12:24:50
请教如何判断treeview 里的根数量(既有几个根目录),谢谢!!!!
...全文
37 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jordi2014 2003-09-03
  • 打赏
  • 举报
回复
dim iCount as integer
dim tnode as node
icount=0
with treeview1
for each tnode in .nodes.
if tnodes(i).parent is nothing then
icount=icount+1
endif
next
end with

msgbox "共有" & icount & "个根节点!"
射天狼 2003-09-03
  • 打赏
  • 举报
回复
同意楼上~~
liul17 2003-09-03
  • 打赏
  • 举报
回复
也可通过在建树时标识不同的关键字 如根结点以Root开头 子结点以Sub开头
lxcc 2003-09-03
  • 打赏
  • 举报
回复
dim nodex as node
dim i as integer
i=0
for each nodex in treeview1.nodes
if nodex.Parent="" then
i=i+1
endif
next

msgbox i
yqy888 2003-09-03
  • 打赏
  • 举报
回复
谢谢两位,运行出错,在请帮助,谢谢!!!!

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧