标题:j解决treeview 的问题
取消只看楼主
luguojun
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2005-9-7
 问题点数:0 回复次数:0 
j解决treeview 的问题

Dim myval As String

Dim rs As ADODB.Recordset

Private Sub Form_Load()

Set rs = New ADODB.Recordset '---------------------------------------- Dim ssql As String, arr As Variant strcn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=g:\zyxy\data\student.mdb;Persist Security Info=false" ssql = "SELECT 班级名称 From T_class ORDER BY 入学时间" ' ssql = "select * from job" Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.CursorLocation = adUseClient cn.ConnectionString = strcn cn.Open rs.Open ssql, cn, adOpenDynamic, adLockBatchOptimistic ' rs.Open ssql, cn arr = rs.GetRows() ' rs.Close 'fill tv TV.Nodes.Clear On Local Error Resume Next For i% = 0 To UBound(arr, 2) '行数 TV.Nodes.Add , , "X" & arr(0, i), arr(0, i) ' TV.Nodes.Add "X" & arr(0, i), tvwChild, "Z" & arr(1, i), arr(1, i) ' TV.Nodes.Add "Z" & arr(1, i), tvwChild, "B" & arr(2, i), arr(2, i) Next End Sub

Private Sub Form_Unload(Cancel As Integer)

On Local Error Resume Next ' rs.Close ' Set rs = Nothing End Sub

Private Sub TV_NodeClick(ByVal Node As MSComctlLib.Node)

Dim ssql As String ' ssql = "select * from T_class where 班级名称='" & Node.Text & "'" Text1.Text = Node.key

ssql = "select * from T_class where 班级名称='" & Node.Text & "'order by 入学时间" If rs.RecordCount <> 0 Then

'If rs.Fields(i) <> "" Then Text("i").Text = Trim(rs.Recordset.Fields(i)) If .Fields("人数") <> "" Then Text2.Text = rs.Fields("人数") If .Fields("班主任") <> "" Then Text3.Text = rs.Fields("班主任") If .Fields("班长") <> "" Then Text4.Text = rs.Fields("班长") If .Fields("年制") <> "" Then Text5.Text = rs.Fields("年制") If .Fields("备注") <> "" Then Text6.Text = rs.Fields("备注") 'If DTP1.Value <> "" Then rs.Fields("入学时间") = DTP1.Value

End If

End Sub treeview控件没什么问题.可以显示我想要的东西

但是我在对text控件付值的时候为什么老是提示说有问题那,请各位指教下.

搜索更多相关主题的帖子: treeview 
2005-09-07 19:27



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




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

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