如何计算文本框值 [英] How to calculating text box values
本文介绍了如何计算文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用c#2010创建Windows应用程序,这里我使用数据网格视图进行计费,我输入网格列中的值,值显示在文本框中,一旦值增加> 100在第一个文本框中,自动为第二个文本框添加+1,
如何在c#windows应用程序中创建我使用下面的代码但不能正常工作。请给我任何一个想法。
I am creating windows application using c# 2010, here I am using data grid view for billing purpose, I am enter the values in grid columns that values are shown on text box, once value is increase > 100 in first text box, automatically adding +1 for second text box,
how to create in c# windows application I am using below code but not working. Please give me any one ideas.
int first;
int sec;
first = int.Parse(textBox2.Text);
sec = int.Parse(txt_netamount.Text);
if (first > 100)
{
sec +=1;
}
我的尝试:
如何计算文本框值
What I have tried:
How to calculating text box values
推荐答案
整数变量sec增加但变量的新值不会自动显示在文本中框,你需要设置它。请尝试以下方法:
The integer variable sec is increased but the new value of the variable isn't automatically shown in the text box, you need to set it. Try the following:
int first;
int sec;
first = int.Parse(textBox2.Text);
sec = int.Parse(txt_netamount.Text);
if (first > 100)
{
sec +=1;
txt_netamount.Text = sec.ToString();
}
这篇关于如何计算文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文