问题描述
有没有在C#的方式来等待,直到用户在文本框取的价值观,他们没有击中进入键入?之前完成键入
Is there a way in C# to wait till the user finished typing in a textbox before taking in values they have typed without hitting enter?
修订这个问题一点:
好吧,我有一个简单的计算器,用2乘以
Okay I have a simple calculator that multiplies by 2.
下面是我想要它做的:用户输入,比如1000的值到一个文本框,它会自动显示2000
Here is what I want it to do: The user inputs a value like 1000 into a textbox and it automatically displays 2000.
下面是发生了什么:当用户在1其乘以2和产出2.进入
Here is what happens: As soon as the user enters in 1 its multiplies by 2 and outputs 2.
推荐答案
您可以使用文本框的onChange()
事件。如果文字文本改变时,检查输入的值是一个数字,计算总价值根据其他值。
You can use textbox onChange()
event. If text is changed in textbox, check if entered value is a number and calculate total value according to the other value.
这篇关于C#等待用户完成输入在文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!