以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  目录树的节点expand错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=186471)

--  作者:tld
--  发布时间:2023/5/5 18:12:00
--  目录树的节点expand错误

老师好。下面代码运行红色字体的时候出现错误:
Dim tv1 As WinForm.TreeView = e.Form.Controls("Tree配置栏")
Dim tb1 As Table = Tables (e.Form.Name & "_table1")
Dim list_cd As New List(Of String)
For Each r As Row In tb1.Rows
    list_cd.Add (r("菜单控件"))
Next
For Each nd As WinForm.TreeNode In tv1.AllNodes
    Dim s As String = nd.FullName 
    If list_cd.Contains (s) Then
        nd.ForeColor = Color.red
        nd.Backcolor =color.Yellow 
        Dim fnd As WinForm.TreeNode = nd.ParentNode 
        fnd.Expand ()
    End If 
Next
‘-------------------------------------错误提示如下
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:窗口,菜单权限,Button1,Click
详细错误信息:
未将对象引用设置到对象的实例。

请您帮忙看看怎么回事?谢谢



--  作者:有点蓝
--  发布时间:2023/5/6 8:44:00
--  
        Dim fnd As WinForm.TreeNode = nd.ParentNode 
if fnd isnot nothing
        fnd.Expand ()
end if
    End If 
Next