现有目录树共有7层:单位名称,部门体系,工作部门,办事处,岗位名称,职位层级,职系,职位职级增加办事处的代码为:
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 = 6 Then
MessageBox.Show("最多允许7层节点!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
ElseIf nd.Level = 1 Then
Dim dr As DataRow = DataTables("部门岗位").Find("部门体系='" &nd.ParentNode.Text & "' and 部门名称='" & nd.text & "' and 办事处 is null")
If dr Is Nothing Then
dr = DataTables("部门岗位").AddNew
End If
dr("单位名称")="XX有限公司"
dr("部门体系") = nd.ParentNode.Text
dr("部门名称") = nd.Text
dr("办事处") = "请增加办事处"
nd = nd.Nodes.Add("请增加办事处")
tr.SelectedNode = nd
tr.Select()
tr.BeginEdit()
End If
End If
但是在增加岗位以及更下层的内容时,部门体系等值应该如何取呢?比如增加岗位时
dr("部门名称") = nd.ParentNode.Text
那部门体系的值应该如何取得?