点击treeview的节点,然后在右边得到相应的不同的界面,同时在同一窗体中
我想在treeview树点击一个节点,同时在右边出现相应的界面。可以说界面是动态变化的,请问要用什么方法了呢?谢谢大神了。我节点已经设置好了。,下面是源代码:Option ExplicitDim X() As String, M As Integer, I As Integer, Number() As Integer, P As Integer, Dj As String
Private CurrentDir As String '建立模块级私有变量,存放当前路径
Private Sub Form_Load()
Dim N As Integer, J As Integer
'说明Mainnode 为节点型变量
Dim MainNode As Node
TreeView1.ImageList = ImageList1
'设置根节点和节点的名称和图标
Set MainNode = TreeView1.Nodes.Add(, , "Root", "标准零件库", "RootImage")
'设置数据库指定数据源
CurrentDir = CurDir("") '获取当前路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + CurrentDir + "\标准零件库.mdb;Persist Security Info=False"
= adCmdTable
Adodc1.RecordSource = "标准件大类"
Adodc1.Refresh
'统计标准零件大类表中的记录总数
Adodc1.Recordset.MoveLast
Adodc1.Recordset.MoveFirst
M = Adodc1.Recordset.RecordCount
'调整数组大小
ReDim X(M) As String, Number(M) As Integer
'获得ID和表名称,设置一级节点名称和节点图标
For I = 1 To M
X(I) = Adodc1.Recordset("表名称")
Number(I) = Adodc1.Recordset("ID")
Set MainNode = TreeView1.Nodes.Add("Root", tvwChild, X(I) & CStr(Number(I)), X(I), "Open1", "Open2")
Adodc1.Recordset.MoveNext
Next I
Adodc1.RecordSource = "标准件小类"
Adodc1.Refresh
'设置二级节点名称和节点图标
Do While Adodc1.Recordset.EOF = False
I = Adodc1.Recordset("ID")
Set MainNode = TreeView1.Nodes.Add(X(I) & CStr(I), tvwChild, , Adodc1.Recordset("零件名称"), "Open3", "Open4")
Adodc1.Recordset.MoveNext
Loop
'将显示数据定位于首记录
Adodc1.Recordset.MoveFirst
End Sub