如何检查用户输入的非法字符? [英] How to check user input for illegal characters?
问题描述
有没有办法检查用户输入的非法字符?
例如,用户在文本框中输入内容并单击确定。
那时我想运行这样的代码:
illegal = Array(\,/,:,*,?,",<,> ,|)
如果Me.TextBox包含非法则
MsgBox"您输入了非法字符。请再试一次。
Me.TextBox = Null
退出Sub
结束如果
欢迎任何建议!
谢谢!
Is there a way to check user input for illegal characters?
For example, a user enters something into a text box and clicks OK.
At that point I''d like to run code such as this:
illegal = Array(\, /, :, *, ?, ", <, >, |)
If Me.TextBox Contains illegal Then
MsgBox "You entered illegal characters. Please try again."
Me.TextBox = Null
Exit Sub
End If
Any suggestions welcome!
Thanks!
推荐答案
我不确定这是一个答案,但如果你使用ASCII字符映射来获得
合法的字母和数字,这将是一种方法。
我无法帮助你不仅如此。
Michael
" deko" < DJ **** @ hotmail.com>在消息中写道
新闻:Lc ***************** @ newssvr27.news.prodigy.co m ...
I''m not sure this is an answer, but if you use the ASCII character maps for
legal letters and numbers that would be a way to do this.
I can''t help you anymore than that.
Michael
"deko" <dj****@hotmail.com> wrote in message
news:Lc*****************@newssvr27.news.prodigy.co m...
有没有办法检查用户输入的非法字符?
例如,用户在文本框中输入内容并单击确定。
此时我想运行代码如下:
非法=数组(\,/,:,*,?,",<,>,|)
如果我。 TextBox包含非法然后
MsgBox"您输入了非法字符。请再试一次。
Me.TextBox = Null
退出Sub
结束如果
欢迎任何建议!
谢谢!
Is there a way to check user input for illegal characters?
For example, a user enters something into a text box and clicks OK.
At that point I''d like to run code such as this:
illegal = Array(\, /, :, *, ?, ", <, >, |)
If Me.TextBox Contains illegal Then
MsgBox "You entered illegal characters. Please try again."
Me.TextBox = Null
Exit Sub
End If
Any suggestions welcome!
Thanks!
我想我把非法的ascii代码放在一个数组中,但是如何gret for
他们在字符串?
" PMB" <下午***** @ megavision.com>在消息中写道
新闻:mF **************** @ news.uswest.net ...
I suppose I cd put the illegal ascii codes in an array, but how to grep for
them in a string?
"PMB" <pm*****@megavision.com> wrote in message
news:mF****************@news.uswest.net...
我是'我不确定这是一个答案,但如果你使用ASCII字符映射
用于合法的字母和数字,这将是一种方法。
我不能再帮你了比那更好。
Michael
deko < DJ **** @ hotmail.com>在消息中写道
新闻:Lc ***************** @ newssvr27.news.prodigy.co m ...
I''m not sure this is an answer, but if you use the ASCII character maps for legal letters and numbers that would be a way to do this.
I can''t help you anymore than that.
Michael
"deko" <dj****@hotmail.com> wrote in message
news:Lc*****************@newssvr27.news.prodigy.co m...
有没有检查用户输入非法字符的方法?
例如,用户在文本框中输入内容并单击确定。
此时我想运行此类代码:
非法=数组(\,/,:,*,?,",<,>,|)
如果Me.TextBox包含非法则
MsgBox"你输入了非法字符。请再试一次。
Me.TextBox = Null
退出Sub
结束如果
欢迎任何建议!
谢谢!
Is there a way to check user input for illegal characters?
For example, a user enters something into a text box and clicks OK.
At that point I''d like to run code such as this:
illegal = Array(\, /, :, *, ?, ", <, >, |)
If Me.TextBox Contains illegal Then
MsgBox "You entered illegal characters. Please try again."
Me.TextBox = Null
Exit Sub
End If
Any suggestions welcome!
Thanks!
2003年10月1日星期三22:05:31 GMT in comp.databases.ms-access ,deko
< dj **** @ hotmail.com>写道:
On Wed, 01 Oct 2003 22:05:31 GMT in comp.databases.ms-access, "deko"
<dj****@hotmail.com> wrote:
有没有办法检查用户输入的非法字符?
例如,用户在文本框中输入内容并单击确定。那时我想运行这样的代码:
非法=数组(\,/,:,*,?,",<,>, |)
如果Me.TextBox包含非法那么
MsgBox"您输入了非法字符。请再试一次。
Me.TextBox = Null
退出Sub
结束如果
欢迎任何建议!
Is there a way to check user input for illegal characters?
For example, a user enters something into a text box and clicks OK.
At that point I''d like to run code such as this:
illegal = Array(\, /, :, *, ?, ", <, >, |)
If Me.TextBox Contains illegal Then
MsgBox "You entered illegal characters. Please try again."
Me.TextBox = Null
Exit Sub
End If
Any suggestions welcome!
>
我在供应商短名称中所做的事情我不允许使用特殊字符
来帮助搜索是使用KeyPress事件,例如
(编辑为简洁)
Private Sub txtShortname_KeyPress(KeyAscii As Integer)
Dim strchar As String
Dim strNoShortName As String
strNoShortName =",。?/ \?`!"£
what I do in my supplier shortname where I disallow special characters
to aid searching is use the KeyPress event, e.g.
(edited for brevity)
Private Sub txtShortname_KeyPress(KeyAscii As Integer)
Dim strchar As String
Dim strNoShortName As String
strNoShortName = ",.?/\?`!"£
这篇关于如何检查用户输入的非法字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!