以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 锁定列 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=137682) |
-- 作者:13775189031 -- 发布时间:2019/7/12 15:32:00 -- 锁定列 Dim dr As DataRow = e.DataRow Select Case e.DataCol.Name Case "实发支数_1","实发支数_2","实发支数_3" If dr.IsNull("实发支数_1") Then dr("发料日期1") = Nothing Else dr("发料日期1") = Date.today End If If dr.IsNull("实发支数_2") Then dr("发料日期2") = Nothing Else dr("发料日期2") = Date.today End If If dr.IsNull("实发支数_3") Then dr("发料日期3") = Nothing Else dr("发料日期3") = Date.today End If End Select 想实现“发料日期1”,“发料日期2”,“发料日期3”的日期必须是不同的,例如如果输入"实发支数_3"时,判断当前日期是否和“发料日期1”和“发料日期2”相同,如果相同则该单元格锁定或无法输入。 |
-- 作者:有点蓝 -- 发布时间:2019/7/12 15:47:00 -- prepareedit事件 Dim dr As Row = e.Row Select Case e.Col.Name Case "发料日期1" If dr("发料日期2") = Date.today orelse dr("发料日期3") = Date.today Then e.cancel = true End If Case "发料日期2" If dr("发料日期1") = Date.today orelse dr("发料日期3") = Date.today Then e.cancel = true End If Case "发料日期3" If dr("发料日期2") = Date.today orelse dr("发料日期1") = Date.today Then e.cancel = true End If End Select |