在 DataColChanging事件中写了如下代码
If e.DataCol.name ="商户注册手机号掩码" Then
If e.NewValue = "" Then
systemready = False
e.DataRow(e.DataCol.name.SubString(0,e.DataCol.name.length-4)) = ""
systemready = True
ElseIf e.newvalue.contains("*") = False Then
Dim r_tele As New System.Text.RegularExpressions.Regex("^1[0-9]{10}$")
If r_tele.IsMatch(e.newvalue) = False Then
msgbox("电话号码不正确")
e.cancel = True
End If
If e.Cancel = False Then
systemready = False
e.DataRow(e.DataCol.name.SubString(0,e.DataCol.name.length-2)) = e.newvalue
e.NewValue = e.NewValue.SubString(0, 3) & "*****" & e.NewValue.SubString(8,3)
systemready = True
End If
Else
msgbox("不能这样修改")
e.cancel = True
End If
End If
如果在文本框中输入是手机号后单击保存不出错,如果是组合框选择带掩码的数据后就会出错,弹出“不能这样修改”提示,怎么处理?