各位老师:
我在窗口中输入数值,想要的效果是:当是开发者登陆时,可以全部编辑,当登陆者的姓名等于当前行检验员的姓名时,才能编辑当前行。(也就是登陆者只能编辑自己的行),但是试运行时,有时能达到想要的效果,有时不能,特别是组合框,请老师指点编码错在什么地方了。
表的数据是外部数据
窗口ENTER事件编码如下:
If e.Sender.Name.SubString(0,4) = "_cmb" Then '如果名称符合
Dim cmb As WinForm.ComboBox = e.Sender
If cmb.Items.Count > 0 Then '如果已经设置了项目
Return '则返回
End If
Dim t As Table = cmb.BindTable '获得绑定的Table
Dim c As Col = cmb.BindCol '获得绑定的Col
Dim dr As DataRow = DataTables("组合框代码").Find("[表] = '" & t.Name & "' And [列] = '" & c.Name & "'")
If dr IsNot Nothing Then '如果在项目表找到对应的行
cmb.Combolist = dr("列表项目") '则设置列表项目
End If
End If
Dim ctl As WinForm.Control = e.Sender
Dim r As Row = Tables("制造质量管理").Current '定义当前行检验员姓名
If r IsNot Nothing Then
If User.Name = "开发者" Then
ctl.ReadOnly = BooleanEnum.False '允许编辑
Else
If User.Name = r("检验员") Then '如果登陆者姓名等于当前行检验员姓名
ctl.ReadOnly = BooleanEnum.False '允许编辑
Else
ctl.ReadOnly = BooleanEnum.True '否则禁止编辑
End If
End If
End If
谢谢!