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 = 4 Then
MessageBox.Show("最多允许五层节点!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Dim dr As DataRow = DataTables("B_Room").AddNew
If nd.Level = 0 Then
dr("仓库一级") = nd.Text
dr("仓库二级") = "新节点"
ElseIf nd.Level = 1
dr("仓库一级") = nd.ParentNode.Text
dr("仓库二级") = nd.text
dr("仓库三级") = "新节点"
ElseIf nd.Level = 2
dr("仓库一级") = nd.ParentNode.Text
dr("仓库二级") = nd.text
dr("仓库三级") = nd.text
dr("仓库四级") = "新节点"
ElseIf nd.Level = 3
dr("仓库一级") = nd.ParentNode.Text
dr("仓库二级") = nd.text
dr("仓库三级") = nd.text
dr("仓库四级") = nd.text
dr("仓库伍级") = "新节点"
ElseIf nd.Level = 4
dr("仓库一级") = nd.ParentNode.Text
dr("仓库二级") = nd.text
dr("仓库三级") = nd.text
dr("仓库四级") = nd.text
dr("仓库伍级") = nd.text
End If
nd = nd.Nodes.Add("新节点")
tr.SelectedNode = nd
tr.Select()
tr.BeginEdit()
End If
End If
此主题相关图片如下:5.png
如上面修改的代码,我发现红色标识的有问题,并且五级的时候是无法输入,请问如何处理?
[此贴子已经被作者于2016/6/6 15:26:00编辑过]