以文本方式查看主题

-  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=127680)

--  作者:qaz17909
--  发布时间:2018/11/19 23:19:00
--  页面集合
页面集合,遍历某个页面的所有控件不可用,如何写代码
--  作者:有点蓝
--  发布时间:2018/11/19 23:26:00
--  
For Each c As WinForm.Control In e.Form..Controls("TabControl1").TabPages(1).Children


--  作者:qaz17909
--  发布时间:2018/11/20 20:59:00
--  
好像不行,我的代码如下,当不是经理的时候,第一个页面的表格和所有按钮不可用,我的代码哪里有问题
窗口afterload事件
Dim t1 As Table = e.Form.Controls("Table1").Table
If User.IsRole("经理") Then
    Return
Else
    t1.AllowEdit = False
    For Each c1 As WinForm.Control In e.Form.Controls("TabControl1").TabPages(0).Children
        If Typeof c1 Is WinForm.Button Then
            c1.Enabled = False
        End If
    Next
End If

--  作者:有点蓝
--  发布时间:2018/11/20 21:20:00
--  
代码我测试没有问题。请上传实例说明
--  作者:qaz17909
--  发布时间:2018/11/20 23:15:00
--  
我知道了,我的控件是放在分区面板里面的,所以无效,只要放在分区面板外即可。请问如果是针对页面中的分区面板内的控件,怎么写代码
--  作者:有点甜
--  发布时间:2018/11/21 8:55:00
--  
以下是引用qaz17909在2018/11/20 23:15:00的发言:
我知道了,我的控件是放在分区面板里面的,所以无效,只要放在分区面板外即可。请问如果是针对页面中的分区面板内的控件,怎么写代码

 

那就遍历分区面板,如

 

Dim sp As WinForm.SplitContainer = e.Form.controls("SplitContainer1")
For Each c As object In sp.Panel1.Children
    msgbox(c.name)
Next
For Each c As object In sp.Panel2.Children
    msgbox(c.name)
Next