vb treeview 控件 怎么一单击子节点, 就能取出其对应数据库中的这条记录的所有信息
2013-09-03
展开全部
Option Explicit Private Enum ObjectType otNone = 0 otFactory = 1 otGroup = 2 otPerson = 3 otFactory2 = 4 otGroup2 = 5 otPerson2 = 6 End Enum Private SourceNode As Object Private SourceType As ObjectType Private TargetNode As Object ' A list of EmployeeProjects each person has worked on. Private Projects As New Collection ' Save information about these projects for this ' employee. Private Sub AddProjects(emp_name As String, ParamArray proj_names() As Variant) Dim emp_proj As New EmployeeProjects Dim i As Integer ' Add the project names to the EmplyeeProjects ' object for this employee. For i = LBound(proj_names) To UBound(proj_names) emp_proj.ProjectNames.Add proj_names(i) Next i ' Add emp_proj to the collection of EmployeeProjects. Projects.Add emp_proj, emp_name End Sub ' *********************************************** ' Return the node's object type. ' *********************************************** Private Function NodeType(test_node As Node) As ObjectType Select Case Left$(test_node.Key, 1) Case "f" NodeType = otFactory Case "g" NodeType = otGroup Case "p" NodeType = otPerson End Select End Function ' *********************************************** ' Prepare the ImageList and TreeView controls. ' *********************************************** Private Sub Form_Load() Dim i As Integer Dim factory As Node Dim group As Node Dim person As Node ' Load pictures into the ImageList. For i = 1 To 6 TreeImages.ListImages.Add , , TreeImage(i).Picture Next i ' Attach the TreeView to the ImageList. OrgTree.ImageList = TreeImages ' Create some nodes. Set factory = OrgTree.Nodes.Add(, , "f
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询