在打字时我会用什么事件来计算字符? [英] What event would I use to count characters WHILE typing?
本文介绍了在打字时我会用什么事件来计算字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户输入文本框时,我需要显示他们输入的字符串的长度。我的代码是......
displayCountLabel.caption = len(me!fieldTheyAreTypingIn)
问题是我似乎无法查找用户连续输入时发生的事件。我试过keydown和keyup和keypress。所有这些都是在第一次出现时开火,但是当用户继续打字时它们不会继续射击。
有谁知道我怎么能这样做?
谢谢
Adam
Hi,
While the user is typing into a text box, I need to display the length of the string they are typing. My code is...
displayCountLabel.caption = len(me!fieldTheyAreTypingIn)
Problem is that I can''t seem to find an event that occurs while the user continuously types. I tried keydown and keyup and keypress. All of them fire on the first occurence but they do not keep firing as the user continues to type.
Does anyone know how I can do this?
Thanks
Adam
推荐答案
您必须使用文本框的更改事件。这将在名为 CharacterCountLabel的标签中显示字符数。
You have to use the Change event of your textbox. This displays the character count in a label named CharacterCountLabel.
展开 | 选择 | Wrap | 行号
哇!!
快速而令人印象深刻的Linq;)
Wow!!
Quick and impressive Linq ;)
之前被询问和回答!我保留了一个充满黑客的文件夹我之前写的帖子。在我高龄时,诀窍是记住我命名文件的魔鬼!
; 0)>
Been asked and answered before! I keep a folder full of hacks I''ve written before for posts. The trick, at my advanced age, is remembering what the devil I named the file!
;0)>
这篇关于在打字时我会用什么事件来计算字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文