Foxtable(狐表)用户栏目专家坐堂 → 登陆者不能在窗口中查找


  共有1970人关注过本帖树形打印复制链接

主题:登陆者不能在窗口中查找

帅哥哟,离线,有人找我吗?
cxmxjwlmq
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:349 积分:4052 威望:0 精华:0 注册:2018/4/6 18:02:00
登陆者不能在窗口中查找  发帖心情 Post By:2018/4/26 10:16:00 [只看该作者]

各位老师、大咖们:

    一个表,设定表事件中,只有登陆者才能修改自己的一行。这个没有出现问题。我绑定表作了录入窗口,窗口中有一个查找TextBox17,便登陆者登陆后,这个查找文件框不能输入,开发者可以输入。

窗口的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

 

TextBox17的Textchanged事件代码:

Dim txt  As  String = e.Form.Controls("TextBox17").Text
 Dim tbl As Table = Tables("制造质量记录_Table1")
 If txt = "" Then
     tbl.Filter = ""
 Else
     txt = "'%" & txt & "%'"
     tbl.Filter = "底盘号 Like " & txt & " Or 发动机号 Like " & txt &  " Or 序号 Like " & txt &  " Or 检验岗 Like " & txt
 End If

求助!


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/26 10:45:00 [只看该作者]

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
If ctl.name = "TextBox17" Then
    If User.Name = "开发者" Then
        ctl.ReadOnly = BooleanEnum.False '允许编辑
    Else
        ctl.ReadOnly = BooleanEnum.True
    End If
End If


 回到顶部
帅哥哟,离线,有人找我吗?
cxmxjwlmq
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:349 积分:4052 威望:0 精华:0 注册:2018/4/6 18:02:00
  发帖心情 Post By:2018/4/26 22:05:00 [只看该作者]

甜老师:我把代码加到后面,但还是不行,别的登陆者登陆还是不能用查询

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/26 22:39:00 [只看该作者]

以下是引用cxmxjwlmq在2018/4/26 22:05:00的发言:

甜老师:我把代码加到后面,但还是不行,别的登陆者登陆还是不能用查询

 

 

不明白你到底要实现什么。是允许使用还是不能使用?

 

If ctl.name = "TextBox17" Then
    If User.Name = "开发者" Then
        ctl.ReadOnly = BooleanEnum.False '允许编辑
    Else
        ctl.ReadOnly = BooleanEnum.False '允许编辑
    End If
End If


 回到顶部
帅哥哟,离线,有人找我吗?
cxmxjwlmq
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:349 积分:4052 威望:0 精华:0 注册:2018/4/6 18:02:00
  发帖心情 Post By:2018/4/26 22:43:00 [只看该作者]

使登陆者都能使用,老师


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/26 22:45:00 [只看该作者]

看4楼代码。

 回到顶部
帅哥哟,离线,有人找我吗?
cxmxjwlmq
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:349 积分:4052 威望:0 精华:0 注册:2018/4/6 18:02:00
  发帖心情 Post By:2018/4/26 22:56:00 [只看该作者]

谢谢甜老师


 回到顶部