以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关于TopicBar授权问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=50195)

--  作者:alangoon
--  发布时间:2014/5/1 0:39:00
--  [求助]关于TopicBar授权问题

由于采用了TopicBar,所以想用最简单的授权方式去做。

原意:

1. 建立一个“权限表”,表里有“用户名”,“模块”,“子模块”,“不可见”列;单击模块列自动显示所有的TopicBar.Pages,编辑“子模块”时自动显示“模块”下的所有TopicBar.Pages().Links.

2. 在权限表的“PrepareEdit”事件中写入如下代码,编译没有问题,但运行时提示错误。不知道哪出现问题了。

    代码:

    Select Case e.Col.Name
        Case "子模块"
            Dim s As String = e.Row("模块")  \'TopicBar.Pages
            Dim lnkname As String
            If s > "" Then
                If e.IsFocusCell Then
                    Dim tp As WinForm.TopicPage
                    tp = Forms("Navi").Controls("TopicBar1").Pages(s)
                    For Each lk As WinForm.TopicLink In tp.Links
                        lnkname = lnkname & " | " & lk.Name
                    Next
                    e.Col.ComboList = lnkname
                End If
            End If

      运行时提示错误:

     


此主题相关图片如下:1.jpg
按此在新窗口浏览图片


 


此主题相关图片如下:2.jpg
按此在新窗口浏览图片
请大神指点。
--  作者:有点酸
--  发布时间:2014/5/2 9:21:00
--  

建议加上判断:

 

Select Case e.Col.Name
    Case "子模块"
        If Forms("Navi").Opened Then
            Dim s As String = e.Row("模块")  \'TopicBar.Pages
            Dim lnkname As String
            If s > "" Then
                If e.IsFocusCell Then
                    Dim tb As WinForm.TopicBar = Forms("Navi").Controls("TopicBar1").
                    Dim tp As WinForm.TopicPage
                    If tb.Pages.Contains(s) Then
                        tp = tb.Pages(s)
                        For Each lk As WinForm.TopicLink In tp.Links
                            lnkname = lnkname & " | " & lk.Name
                        Next
                        e.Col.ComboList = lnkname
                    End If
                End If
            End If
    End Select
   

还不行的话,你可以用这个方法分析一下,找出出错的代码,基本就知道原因了:

http://www.foxtable.com/help/topics/1485.htm