如何实现按当前用户限制表A的列是否编辑?需求如图,下面代码如何改?Select Case User.Name
Case "张三","李四"
Select Case e.Col.Name
Case "第一列","第二列","第三列"
e.Cancel = True
End Select
Case "王五", "赵六"
Select Case e.Col.Name
Case "第四列","第五列","第六列"
e.Cancel = True
End Select
End Select
If e.Col.Name = "第十列" Then
If User.Name <> "张经理" Then
e.Cancel = True
End If
End If
此主题相关图片如下:列是否可编辑.jpg

Select Case e.Col.Name
Case "直接上级","间接上级"if e.row("经办人") = user.name
e.Cancel = True
end if
End Select
Select Case e.Col.Name
Case "直接上级意见"
case else
if e.row("直接上级") = user.name
e.Cancel = True
end if
Case "间接上级意见"
case else
if e.row("间接上级") = user.name
e.Cancel = True
end if
End Selectif e.row("审核") = "已审核"
e.Cancel = True
end if
Select Case e.Col.Name
Case "直接上级意见"
case else
if e.row("直接上级") = user.name
e.Cancel = True
end if
Case "间接上级意见"
case else
if e.row("间接上级") = user.name
e.Cancel = True
end if
End Select
报错不能同在一起
[此贴子已经被作者于2025/4/16 10:53:13编辑过]
Select Case e.Col.Name
Case "直接上级意见"
case else
if e.row("直接上级") = user.name
e.Cancel = True
end if
End Select
Select Case e.Col.Name
Case "间接上级意见"
case else
if e.row("间接上级") = user.name
e.Cancel = True
end if
End Select
执行后,当前登录用户是张三时,全部列都可以编辑,需求是
"直接上级意见"和"间接上级意见"列是不编辑,其他列是可编辑,还是达不到需求是什么原因如何改?
_user.name设为用户的全局变量
Select Case e.Col.Name Case "直接上级","间接上级"if e.row("经办人") = _user.name e.Cancel = True end if End Select |
Select Case e.Col.Name
Case "直接上级意见"
case else
if e.row("直接上级") = _user.name
e.Cancel = True
end if
End Select
Select Case e.Col.Name
Case "间接上级意见"
case else
if e.row("间接上级") = _user.name
e.Cancel = True
end if
End Select
if e.row("审核") = "已审核"
e.Cancel = True
end if
执行后,对窗口上表绑定窗口的控件的文本框没限制,如何改?
[此贴子已经被作者于2025/4/16 12:30:33编辑过]
Dim ctl As WinForm.Control = e.Sender
Select Case ctl.BindingField
Case "Tables("窗口_Table1").Cols("日期")", "表A.第二列", "表A.第三列"
If User.Name = "张三" Then
ctl.ReadOnly = BooleanEnum.False '允许编辑
Else
ctl.ReadOnly = BooleanEnum.True '禁止编辑
End If
"Tables("窗口_Table1").Cols("日期")", 报错?
Dim c1 As Col = Tables("窗口_Table1").Cols("直接上级")
Dim ctl As WinForm.Control = e.Sender
Select Case ctl.BindingField
Case "r.直接上级意见"
If c1 = _HLName Then 报错提示,Col无法转string?如何改?
ctl.ReadOnly = BooleanEnum.False '允许编辑
Else
ctl.ReadOnly = BooleanEnum.True '禁止编辑
End If
[此贴子已经被作者于2025/4/16 15:15:15编辑过]
建议重头学一遍编程基础
Case "窗口_Table1.日期"
If c1.name = _HLName Then