标题:求vb 中实现treeview子节点功能代码
只看楼主
wenwenzengze
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2013-5-15
结帖率:100%
已结贴  问题点数:10 回复次数:4 
求vb 中实现treeview子节点功能代码
程序代码:
Dim nodX As Node
   Set nodX = TreeView1.Nodes.Add(, , "X1", "教学计划", 1)
  
   Set nodX = TreeView1.Nodes.Add(, , "X2", "学习要求", 1)
   Set nodX = TreeView1.Nodes.Add("X2", tvwChild, "C1", "目标", 2)
   Set nodX = TreeView1.Nodes.Add("X2", tvwChild, "C2", "重点", 2)
   Set nodX = TreeView1.Nodes.Add("X2", tvwChild, "C3", "难点", 2)
   nodX.EnsureVisible
  
   Set nodX = TreeView1.Nodes.Add(, , "X3", "例题精讲", 1)
  
   Set nodX = TreeView1.Nodes.Add(, , "X4", "课程测试", 1)
   Set nodX = TreeView1.Nodes.Add("X4", tvwChild, "C4", "分数设置", 2)
   Set nodX = TreeView1.Nodes.Add("X4", tvwChild, "C5", "分数查询", 2)
   Set nodX = TreeView1.Nodes.Add("X4", tvwChild, "C6", "修改试题", 2)
   Set nodX = TreeView1.Nodes.Add("X4", tvwChild, "C7", "加选择题", 2)
   Set nodX = TreeView1.Nodes.Add("X4", tvwChild, "C8", "加填空题", 2)
   Set nodX = TreeView1.Nodes.Add("X4", tvwChild, "C9", "加判断题", 2)
   nodX.EnsureVisible
  
   Set nodX = TreeView1.Nodes.Add(, , "X5", "师生互动", 1)
   Set nodX = TreeView1.Nodes.Add("X5", tvwChild, "C10", "接受文件", 2)
   Set nodX = TreeView1.Nodes.Add("X5", tvwChild, "C11", "师生交流", 2)
  
  
   Set nodX = TreeView1.Nodes.Add(, , "X6", "成绩考核", 1)
   Set nodX = TreeView1.Nodes.Add("X6", tvwChild, "C12", "成绩管理", 2)
   Set nodX = TreeView1.Nodes.Add("X6", tvwChild, "C13", "成绩排序", 2)
   nodX.EnsureVisible

 
   Set nodX = TreeView1.Nodes.Add(, , "X7", "系统管理", 1)
   Set nodX = TreeView1.Nodes.Add("X7", tvwChild, "C14", "用户管理", 2)
   Set nodX = TreeView1.Nodes.Add("X7", tvwChild, "C15", "系统日志", 2)
   Set nodX = TreeView1.Nodes.Add("X7", tvwChild, "C16", "退出系统", 2)
   nodX.EnsureVisible
单击treeview下的子节点 实现他们的功能 比如打开某个窗体 或者其他一些功能 谢谢了
搜索更多相关主题的帖子: 学习 
2013-05-15 22:18
曙光电子
Rank: 3Rank: 3
等 级:论坛游侠
威 望:2
帖 子:85
专家分:160
注 册:2012-6-9
得分:10 
回复 楼主 wenwenzengze
工作太忙,没时间改你的代码,直接给你一个案例,你对照自已改吧!
Private Sub Form_Load()
TreeView1.LineStyle = tvwRootLines
 TreeView1.Nodes.Add , , "dianshi", "父节点"
 TreeView1.Nodes.Add "dianshi", tvwChild, "hebei1", "窗体1"
 TreeView1.Nodes.Add "dianshi", tvwChild, "hebei2", "窗体2"
End Sub
Private Sub TreeView1_DblClick()

Select Case TreeView1.SelectedItem.Key
   Case "hebei1"
       WMP1.URL = 窗体1.show
   Case "hebei2"
       WMP1.URL = 窗体1.show
   
        '........
End Select
End Sub
2013-05-16 10:34
wenwenzengze
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2013-5-15
得分:0 
回复 2楼 曙光电子
多谢您的帮助,我做出来了,谢谢。。。。。。。
2013-05-16 13:03
wenwenzengze
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2013-5-15
得分:0 
回复 2楼 曙光电子
您好,能不能再帮帮忙,怎样用vb编程打开一个word文档,感激不尽呀。。。。
2013-05-16 16:19
曙光电子
Rank: 3Rank: 3
等 级:论坛游侠
威 望:2
帖 子:85
专家分:160
注 册:2012-6-9
得分:0 
回复 4楼 wenwenzengze
Dim Word As Object
  On Error Resume Next
            Set Word = CreateObject("Word.Application")
                Set a = Word.Documents.Open(App.Path & "\Word文件名.doc")
                Word.Visible = True
                a.PrintPreview
得到答案怎么不给分哦?
2013-05-16 19:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-407200-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.173769 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved