以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]帮组文件中例子无效  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=64586)

--  作者:yuanyuankt
--  发布时间:2015/2/24 22:50:00
--  [求助]帮组文件中例子无效

DataRowLockedChanging中的代码

If e.DataRow("审核确认") = False Then  \'未审核通过的行

    If e.DataRow.Locked  = False Then \'如果此行目前未锁定,也就是准备锁定此行

        Messagebox.show("不能锁定未审核通过的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)

        e.Cancel = True

    End If

ElseIf e.DataRow("审核确认") = True Then \'已经审核通过的行

    If e.DataRow.Locked  = True Then \'如果此行已锁定,也就是准备取消锁定此行

        If User.Group <> "经理组" Then

            Messagebox.show("只有经理才能解锁已经审核通过的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)

            e.Cancel = True

        End If

    End If

End If


设置好后,无效果,点击审核确认逻辑列,无锁定和对话框出现。是啥原因呢?


--  作者:有点甜
--  发布时间:2015/2/24 22:55:00
--  
 呃,不是点击逻辑列啊,是你锁定行的时候才执行上面的代码啊
--  作者:有点甜
--  发布时间:2015/2/24 22:56:00
--  

 你可以在Datacolchanged事件加入代码,如

 

If e.DataCol.Name = "审核确认" Then e.DataRow.Locked = e.NewValue


--  作者:yuanyuankt
--  发布时间:2015/2/24 22:58:00
--  
谢谢指教!