当选择TreeView的结点时,显示出不同数据

lizhiming19811981 2003-03-21 05:19:00
比如:当选择第一个子结点时,msgbox "hello"
当选择第二个子结点时,msgbox "hi"
...全文
85 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
billyqiao 2003-03-22
  • 打赏
  • 举报
回复
select case node.text
case "第一个结点"
msgbox "Hello"
case "第二个结点"
msgbox "Hi"
end select
northwolves 2003-03-22
  • 打赏
  • 举报
回复
Private Sub Form_Load()
TreeView1.Nodes.Add , , "r", "root"
TreeView1.Nodes.Add "r", tvwChild, "n1", "node1"
TreeView1.Nodes.Add "r", tvwChild, "n2", "node2"
TreeView1.Nodes.Add "r", tvwChild, "n3", "node3"
End Sub



Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
On Error Resume Next
If Node.Parent.Key = "r" Then
If Node.Index = 2 Then MsgBox "hello"
If Node.Index = 3 Then MsgBox "hi"
End If
End Sub
CloneCenter 2003-03-22
  • 打赏
  • 举报
回复
大家都说过了,根据 KEY 来判断了!
smilingchen 2003-03-22
  • 打赏
  • 举报
回复
想做什么呢?
你想获得treeview中的node的什么属性?
Cooly 2003-03-21
  • 打赏
  • 举报
回复
每个节点都有不同的Key,你判断一下Key就可以了

1,451

社区成员

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

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