代码运行错误,到第二段时老提示无法创建子列表
Public Function addtree(ByVal ds As DataSet, ByVal treename As TreeNodeCollection, ByVal x1 As Integer) As BooleanDim dt As DataTable = ds.Tables("Me.XMTN.客户分类")
Dim dm As BindingManagerBase = Me.BindingContext(ds, "Me.XMTN.客户分类")
Dim dr As DataRow() = dt.Select("Me.XMTN.客户分类.本级编号=" & x1.ToString)
Dim dr1 As DataRow
Dim nd As TreeNode
Dim x2 As Integer
If dr.GetLength(0) <> 0 Then
For Each dr1 In dr
nd = treename.Add(dr1("Me.XMTN.客户分类.类别名称"))
nd.Tag = (dr1("Me.XMTN.客户分类.类别编号"))
x2 = treename.IndexOf(nd)
addtree(ds, treename.Item(x2).Nodes, dr1("Me.XMTN.客户分类.类别编号"))
Next
End If
Return True
End Function