当我更改文本框的值时如何调用计算功能 [英] How Do I Call Compute Function When I Change Value Of A Text Box

查看:93
本文介绍了当我更改文本框的值时如何调用计算功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个文本框和一个功能,在加载期间tabcontrol的pagetab中我可以调用该函数来获取4个文本框的值并将结果保存到文本框中。我希望在4个文本框中的任何一个更改其值或用户为其中任何一个输入值之后执行相同的调用函数和自动计算。我能够阅读授权和活动。我有一个给出了一个代码和事件的示例代码,我可能会对此有所了解。



提前谢谢

I have 4 text boxes and a function with in pagetab of tabcontrol during load i was able to call that function to get values of the 4 textboxes and save the result to a textbox. I want to do the same call the function and auto compute when any of the 4 textboxes has changed its value or after user enter a value to any of them. I was able to read delegation and event. I some one give a sample code that has this delegate and event which i might get idea with.

Thank you in advance

推荐答案

假设WinForms:

在更改焦点和验证事件后会触发验证事件。在验证中,如果有人输入无效值,您可以取消更改,在Validated事件中,您可以调用所需的任何功能。



无需代表或任何复杂的事情。由于您没有显示任何代码,这是我能做的最好的。
Assuming WinForms:
There is Validated event that will trigger after changing focus and Validating event. In Validating you can cancel the change if someone enters invalid value, in Validated event you call whatever function you need.

No need for delegates or anything complex. Since you're not showing any code, this is the best I can do.


这篇关于当我更改文本框的值时如何调用计算功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆