以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于禁止输入标点符号 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=173560) |
-- 作者:fvcfox -- 发布时间:2021/12/6 8:22:00 -- 关于禁止输入标点符号 在KeyPressEdit用如下,可以实现禁止输入标点符号,但怎样防止复制粘贴有标点符号呢 If e.Col.Name="名称" Then If Char.IsSymbol(e.KeyChar) Then \'如果输入的是符号或者标点 MessageBox.Show("不能输入标点符号") e.Cancel = True \'则取消此次字符输入 End If End If
|
-- 作者:有点蓝 -- 发布时间:2021/12/6 9:04:00 -- datacolchanging事件 If e.DataCol.Name="第二列" AndAlso e.NewValue > "" Then Dim p As String = "^[0-9a-zA-Z\\u4e00-\\u9fa5]+$" Dim rgx = new System.Text.RegularExpressions.Regex(p, System.Text.RegularExpressions.RegexOptions.IgnoreCase) If Not rgx.isMatch(e.NewValue) Then MessageBox.Show("不能输入标点符号") e.Cancel = True \'则取消此次字符输入 End If End If |