| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 487 人关注过本帖
标题:还是treeview的问题
只看楼主 加入收藏
DURED
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2005-5-8
收藏
 问题点数:0 回复次数:0 
还是treeview的问题
Dim rs1 As New ADODB.Recordset
Private nod As Node
----------------------------------------------------------------------------------------------------------------------------
Private Sub Form_Load()
Dim node1 As Node
Dim node2 As Node
Dim node3 As Node
 Dim key, text As String
 Dim nod As Node
 Adodc1.RecordSource = "select * from p_xlkind order by spxlcode"
 Adodc1.Refresh
 If Adodc1.Recordset.RecordCount > 0 Then
  Adodc1.Recordset.MoveFirst
  Do While Adodc1.Recordset.EOF = False
   If Len(Trim(Adodc1.Recordset.Fields("spxlcode"))) = 2 Then
      key = Trim(Adodc1.Recordset.Fields("spxlcode"))
      text = "(" & Trim(Adodc1.Recordset.Fields("spxlcode")) & ")" & Trim(Adodc1.Recordset.Fields("sspxl"))
     Set node1 = TreeView1.Nodes.Add(, , key, text, 1)
   End If
   If Len(Trim(Adodc1.Recordset.Fields("spxlcode"))) = 4 Then
      key = Trim(Adodc1.Recordset.Fields("spxlcode"))
      text = "(" & Trim(Adodc1.Recordset.Fields("spxlcode")) & ")" & Trim(Adodc1.Recordset.Fields("sspxl"))
      Set node2 = TreeView1.Nodes.Add(node1.Index, tvwChild, key, text, 2)
   End If
   If Len(Trim(Adodc1.Recordset.Fields("spxlcode"))) = 6 Then
      key = Trim(Adodc1.Recordset.Fields("spxlcode"))
      text = "(" & Trim(Adodc1.Recordset.Fields("spxlcode")) & ")" & Trim(Adodc1.Recordset.Fields("sspxl"))
      Set node3 = TreeView1.Nodes.Add(node2.Index, tvwChild, key, text, 3)
   End If
   Adodc1.Recordset.MoveNext
  Loop
End If
End Sub
2005-08-09 17:02
快速回复:还是treeview的问题
数据加载中...
 
   



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

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