你勾选【只可见】的时候,【不可编辑】勾选、【不可见】取消勾选,不就是达到了同样的效果?
或者改成
Tables("授权表").Visible = (User.Type <> UserTypeEnum.User )
If User.Type = UserTypeEnum.User Then
For Each t As Table In Tables
t.Visible = False
For Each c As Col In t.Cols
c.Visible = False
Next
Next
For Each dr As DataRow In DataTables("授权表").Select("分组名= '" & User.Group & "'" )
If dr("只可见")=True Then
If dr.IsNull("列名") Then
Tables(dr("表名")).Visible=True
Tables(dr("表名")).AllowEdit=False
Else
Tables(dr("表名")).Visible=True
Tables(dr("表名")).Cols(dr("列名")).Visible = True
Tables(dr("表名")).Cols(dr("列名")).AllowEdit = False
End If
Else If dr.IsNull("列名") Then
Tables(dr("表名")).Visible = Not dr("不可见")
Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
Else
Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
Tables(dr("表名")).Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
End If
Next
End If
[此贴子已经被作者于2018/4/4 9:43:37编辑过]