以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  这段代码有错误  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=88282)

--  作者:天蝉一线
--  发布时间:2016/7/30 17:20:00
--  这段代码有错误
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
Dim nd1 As WinForm.TreeNode = trv1.SelectedNode
Dim dr As DataRow
If e.Node.ParentNode IsNot Nothing Then \'取消父节点的选中标记,因为选中子节点,就不要选中父节点了
    e.Node.ParentNode.Checked = False
End If
For Each cnd As WinForm.TreeNode In e.Node.Nodes \'取消子节点的选中标记,因为选中父节点,就不要选中子节点了
    cnd.Checked = False
Next
If nd1.Level = 0 Then
    dr = DataTables("授权").Find("功能模块 = \'" & nd1.Name & "\' And 窗口菜单 Is Null")
Else
    dr = DataTables("授权").Find("功能模块 = \'" & nd1.ParentNode.Name & "\' And 窗口菜单 = \'" & nd1.Name & "\'")
End If
If dr IsNot Nothing Then
    Dim nms As String
    For Each nd2 As WinForm.TreeNode In trv2.AllNodes
        If nd2.Checked  Then
            nms  = nd2.Name
        End If
    Next
    If nms > "" Then
        dr("用户角色") = nms
    Else
        dr("用户角色") = Nothing
    End If
End If

错误提示:.NET Framework 版本:2.0.50727.5485
Foxtable 版本:2016.6.21.1
错误所在事件:窗口,权限管理,TreeView2,AfterCheckNode
详细错误信息:
未将对象引用设置到对象的实例。


--  作者:Hyphen
--  发布时间:2016/7/30 17:39:00
--  
Dim nd1 As WinForm.TreeNode = trv1.SelectedNode
if nd1 is nothing then return