如何在文本框中取消字符输入?
我希望能够在我的文本框中只输入字母。如果用户
输入除字母以外的任何内容,输入的密钥就不会显示在文本框中。$
我怎么能那个?那个?
谢谢
Hi,
I''d like to be able to enter only letters in my text box. If a user
enters anything except a letter, the key entered would simply not be
displayed in the text box.j
How can I do ;that?
Thank you
我得到了这个一个人:
内部文本框KeyPress事件:
if(char.IsLetter(e.KeyChar)= false)然后
e.Handled = true
结束如果
非常感谢
周一,2004年5月10日18:51:50 GMT,Dino Buljubasic
< di ** @ noplacelikehome.com>写道:
I got this one by myself :
Inside text box KeyPress events do :
if (char.IsLetter(e.KeyChar) = false) then
e.Handled = true
end if
Thanks anyways
On Mon, 10 May 2004 18:51:50 GMT, Dino Buljubasic
<di**@noplacelikehome.com> wrote:
我希望能够在我的文本框中只输入字母。如果用户输入除了字母之外的任何内容,输入的密钥就不会显示在文本框中。我怎么能这样做?
谢谢
Hi,
I''d like to be able to enter only letters in my text box. If a user
enters anything except a letter, the key entered would simply not be
displayed in the text box.j
How can I do ;that?
Thank you
* Dino Buljubasic< di ** @ noplacelikehome.com> scripsit:
* Dino Buljubasic <di**@noplacelikehome.com> scripsit:
我希望能够在我的文本框中只输入字母。如果用户输入除了字母之外的任何内容,输入的密钥就不会显示在文本框中.j
I''d like to be able to enter only letters in my text box. If a user
enters anything except a letter, the key entered would simply not be
displayed in the text box.j
我不会限制用户输入某些字符。相反,我
会在其''Validating''事件中添加一个处理程序,并检查
内容的文本框。如果它不是有效,你可以在
上设置一个错误的控制器。
-
Herfried K. Wagner [MVP]
< URL:http://dotnet.mvps.org/>
I would not restrict the user to enter certain characters. Instead, I
would add a handler to its ''Validating'' event and check the content of
the textbox there. If it''s not "valid", you can set an errorprovider on
that control.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Herfried:
我很感兴趣。你为什么主张要求用户输入,
让他们输入任何他们喜欢的东西,然后 - 只有在他们已经完成了b
之后 - 告诉他们他们不能用他们打字的东西?
谢谢,
Russell Jones,
执行编辑, DevX.com
" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道
新闻:2g *********** @ uni-berlin.de ...
Herfried:
I''m interested. Why are you advocating asking the user to make an entry,
letting them type whatever they like, and then--only after they''ve
finished--telling them that they can''t use what they''ve typed?
Thanks,
Russell Jones,
Executive Editor, DevX.com
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2g***********@uni-berlin.de...
* Dino Buljubasic< di ** @ noplacelikehome.com> scripsit:
* Dino Buljubasic <di**@noplacelikehome.com> scripsit:
我希望能够在我的文本框中只输入字母。如果用户输入除字母以外的任何内容,则输入的密钥将不会显示在文本框中.j
I''d like to be able to enter only letters in my text box. If a user
enters anything except a letter, the key entered would simply not be
displayed in the text box.j
我不会将用户限制为输入某些字符。相反,我会在其''Validating''事件中添加一个处理程序,并检查那里的文本框的内容。如果它不是有效,你可以在
上设置一个错误的控制器。
-
Herfried K. Wagner [MVP]
< ;网址:http://dotnet.mvps.org/>
I would not restrict the user to enter certain characters. Instead, I
would add a handler to its ''Validating'' event and check the content of
the textbox there. If it''s not "valid", you can set an errorprovider on
that control.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>