CaseStudy目录下的文件:目录树与数据表.Table中
“增加子节点”按钮的Click事件代码:
Dim tr As WinForm.TreeView
Dim nd As WinForm.TreeNode
tr = e.Form.Controls("TreeView1")
nd = tr.SelectedNode
If nd IsNot
Nothing
Then
If nd.Level = 2
Then
MessageBox.Show("最多允许三层节点!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Dim dr As
DataRow = DataTables("表A").AddNew
If nd.Level = 0
Then
dr("大类") = nd.Text
dr("二类") = "新节点"
ElseIf nd.Level = 1
dr("大类") = nd.ParentNode.Text
dr("二类") = nd.text
dr("三类") = "新节点"
End
If
nd = nd.Nodes.Add("新节点")
tr.SelectedNode = nd
tr.Select()
tr.BeginEdit()
End
If
End
If
我想改成,每增加一个新节点,名称不是“新节点”,而是对应的“二类”、“三类”
老师:如何做?