本文介绍了Cout编号在文本框中的书面信件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我有desctop应用程序,我有一些文本框,我必须在其中写一些单词,点击按钮后会发生一些事情。是否有一些方法我可以找到,用户在单击按钮之前写入文本框的字母数?例如,他必须写hallo并写halo,然后删除o并重写lo然后单击按钮。所以他写了hallo,但我想要一些可以计算的方法,他总共写了6个字母而不是5个文本框。 Ty for Answer。
Hallo, I have desctop application, i have some textbox and i must write some word in it and after click button something happen. Is there some method were i can find out, how many letters user write to textbox before he click button? For example he must write "hallo" and he write "halo", then he delete "o" and rewrite "lo" and then click button. So he write "hallo" but I want some method that will count, that he write totally 6 letters and dont 5 as is at textbox. Ty for Answer.
推荐答案
private int pressed = 0;
private void myTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (char.IsLetterOrDigit(e.KeyChar))
{
pressed++;
}
}
这篇关于Cout编号在文本框中的书面信件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!