在3个文本框中输入值,并在第4个显示计算结果 [英] Input values in 3 textboxes and display the calculation result in 4th
本文介绍了在3个文本框中输入值,并在第4个显示计算结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我最近建立了一个网站,根据各种条件计算您的房屋预算。对于演示,我制作了4个方框,第1个用于工资,相应的第2个和第3个用于支出。
如何输入第1个,第2个第3个文本框的值并显示第1个的减去值 - (第二个+第三个文本框)进入第四个?
Hello everyone,
I recently made a website which calculates your home budget on the basis of various conditions. For the demo I made 4 boxes, 1st for salary and corresponding 2nd and 3rd for expenditures.
How can I input the values of 1st, 2nd n 3rd text boxes and display the subtracted value of 1st - (2nd + 3rd text box) into the fourth one?
推荐答案
由于你没有提到你使用哪种语言我用C#尝试,当你按一个按钮时,计算是完成并在第4个文本框中显示结果..
As you not mentioned which language you use i try it with C#,when you press a button the calculation is done and show the result in 4th textbox..
protected void Button1_Click(object sender, EventArgs e)
{
double value1, value2, value3, value4;
value1 = Convert.ToDouble(TextBox2.Text);
value2 = Convert.ToDouble(TextBox3.Text);
value3 = Convert.ToDouble(TextBox4.Text);
value4=value1-(value2+value3);
TextBox5.Text = value4.ToString();
}
这篇关于在3个文本框中输入值,并在第4个显示计算结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文