Dim ctl As WinForm.Control = e.Sender
Select Case ctl.BindingField
Case "增值税fa piao开piao登记.合同编号","增值税fa piao开piao登记.申请日期","增值税fa piao开piao登记.外经证开piao日期"
If User.IsRole("开piao录入") Then
ctl.ReadOnly = BooleanEnum.False '允许编辑
Tables("增值税fa piao开piao登记").Current("合同编号").locked = False
Else
MessageBox.show("你不能修改该记录!")
ctl.ReadOnly = BooleanEnum.True '禁止编辑
End If
End Select
你在leave事件,记得重新locked一下。