以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  位数不正确时,自动提醒错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=161667)

--  作者:天宇科技
--  发布时间:2021/3/25 21:35:00
--  位数不正确时,自动提醒错误
当身份证号不等于18位于时,就提醒。但这个代码,提醒后点几次确定,就可以输入下一列的内容,错在哪儿
我想实现的让操作者必须完成18位的数值输入才行。
Dim s As String =Tables("高级一览表").Current("证件号码")

If  e.DataCol.Name = "证件号码" Then
    If s.Length <> 18 Then
        Dim Result As DialogResult
        Result = MessageBox.Show("身份证号码不正确,请修改!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
        If result =DialogResult.yes
            e.Cancel = True
        End If
    End If
End If



--  作者:有点蓝
--  发布时间:2021/3/25 21:48:00
--  
基本凡是表事件的e参数有row、datarow这些的都不要使用Current

If  e.DataCol.Name = "证件号码" Then
Dim s As String =e.datarow("证件号码")
    If s.Length <> 18 Then
       e.Cancel = True
        MessageBox.Show("身份证号码不正确,请修改!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
    End If
End If

--  作者:天宇科技
--  发布时间:2021/3/25 21:52:00
--  
大神就不一样