错误提示-------------------------------------------------
.NET Framework 版本:4.0.30319.34209
Foxtable 版本:2020.1.19.19
错误所在事件:自定义函数财务科目树生成
详细错误信息:
调用的目标发生了异常。
无法将类型为“Foxtable.WinForm.TreeNode”的对象强制转换为类型“System.Collections.Generic.List`1[Foxtable.WinForm.TreeNode]”。
载入窗口后代码--------------------------------------------
Dim tr As WinForm.TreeView = e.Form.Controls("树")
Dim l As List(of String) = DataTables("会计科目表").GetValues("科目大类",,"科目大类")
For Each s As String In l
tr.Nodes.Add(s , s )
Next
Functions.Execute("财务科目树生成", tr.AllNodes , DataTables("会计科目表"),"级码" )
自定义函数--------------------------------------------------------------------
Dim tr_nd As List(of Foxtable.WinForm.TreeNode) = args(0)
Dim dt As DataTable = args(1)
Dim cn As String = args(2)
For Each n As Foxtable.WinForm.TreeNode In tr_nd
Dim ls As List(of DataRow) = dt.Select("[" & cn & "] like '" & n.Name & "\%'" ,cn )
For Each r As DataRow In ls
Functions.Execute("财务科目树生成", n.Nodes.Add( r("科目代码") , r("科目名称") ) ,dt,cn )
Next
Next