以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]窗口页面授权代码修改  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=110820)

--  作者:liuyixin662
--  发布时间:2017/12/10 14:08:00
--  [求助]窗口页面授权代码修改

老师你好,窗口页面授权代码如下;

根据\'\'页面授权表\'\'控制窗口中的页面的隐藏与显示,代码如下:

For Each pg  As WinForm.TabPage In e.Form.Controls("查询").TabPages
    For Each dr As DataRow In DataTables("页面授权表").Select("用户名 = \'" & User.Name & "\' and  窗口名 = \'" & e.Form.Name & "\'")
        Dim ctls() As String = dr("页面名").split(",")
        For Each c1 As String In ctls
            pg.Visible = not dr("不可见")
        Next
    Next  
Next

麻烦老师修改一下


--  作者:有点甜
--  发布时间:2017/12/10 14:56:00
--  
For Each dr As DataRow In DataTables("页面授权表").Select("用户名 = \'" & User.Name & "\' and  窗口名 = \'" & e.Form.Name & "\'")
    Dim ctls() As String = dr("页面名").split(",")
    For Each c1 As String In ctls
        e.Form.Controls("查询").TabPages(c1).Visible = not dr("不可见")
    Next
Next

--  作者:liuyixin662
--  发布时间:2017/12/10 15:08:00
--  
谢谢老师
--  作者:liuyixin662
--  发布时间:2017/12/10 16:18:00
--  

老师你好,当c1 is nothing ,不显示所有页面,     我用下面的代码无效,麻烦老师改一下

For Each pg  As WinForm.TabPage In e.Form.Controls("查询").TabPages
                pg.Visible =False


--  作者:有点甜
--  发布时间:2017/12/10 17:04:00
--  
For Each pg  As WinForm.TabPage In e.Form.Controls("查询").TabPages
    pg.Visible =False
Next
Dim drs = DataTables("页面授权表").Select("用户名 = \'" & User.Name & "\' and  窗口名 = \'" & e.Form.Name & "\'")
For Each dr As DataRow In drs
    Dim ctls() As String = dr("页面名").split(",")    
    For Each c1 As String In ctls
        e.Form.Controls("查询").TabPages(c1).Visible = not dr("不可见")
    Next
Next

--  作者:liuyixin662
--  发布时间:2017/12/10 17:26:00
--  

谢谢老师