文本框实时太阳和减法,例如订单总数 [英] Text boxes live Sun and Subtraction eg Order total

查看:51
本文介绍了文本框实时太阳和减法,例如订单总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有textbox1和textbox2。让我们假设textbox2的值为int 20.所以任务是我想要textbox2值与textbox1的总和并存储在texbox2中。如果我退格textbox1值然后从texbox2减去?

I have textbox1 and textbox2. let suppose  textbox2 has value int 20. So the task is i want sum of textbox2 value with textbox1 and store in texbox2. if i backspace textbox1 value then it subtract from texbox2?

推荐答案

由于TextBox中的数据(.Text属性)是一个字符串,你必须使用  int.TryParse()方法转换TextBox值。根据您的需要 "工作流程"和"工作流程"。您的应用程序可以工作,您可以将代码放在
Button Click事件处理程序或TextBox Changed事件处理程序中。 

Since data in TextBox (the .Text property) is a string, you'll have to use the int.TryParse() method to convert your TextBox values. Depending on how you want the "workflow" of your application to work, you could put code in either a Button Click event handler, or a TextBox Changed event handler. 

让我们看看你的一些代码已经尝试过,让我们知道你遇到问题的地方。

Let's see some of the code you have already tried and let us know where you're having a problem.


这篇关于文本框实时太阳和减法,例如订单总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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