正确的功能应该是Lb1SumF PLUS Lb2SumF等于Lb3SumF,但是当我输入票证编号时,我的程序没有显示它的正确功能。
这里是a link!是设计。
这是我的代码。
公共局部类Form1:表单 {
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
TX1.Text = "0";
TX1.Focus();
TX2.Text = "0";
textBox2.Text = "10000";
}
private void TX1_TextChanged(object sender, EventArgs e)
{
try
{
int sum;
sum = Convert.ToInt32(TX1.Text) * Convert.ToInt32(Lb1PriceF.Text);
Lb1SumF.Text = Convert.ToString(sum);
}
catch
{
Lb1SumF.Text = "";
}
}
private void TX2_TextChanged(object sender, EventArgs e)
{
try
{
int sum;
sum = Convert.ToInt32(TX2.Text) * Convert.ToInt32(Lb2PriceF.Text);
Lb2SumF.Text = Convert.ToString(sum);
}
catch
{
Lb2SumF.Text = "";
}
}
private void Lb3SumF_TextChanged(object sender, EventArgs e)
{
try
{
int summ;
summ = Convert.ToInt32(Lb1SumF.Text) + Convert.ToInt32(Lb2SumF.Text);
Lb3SumF.Text = Convert.ToString(summ);
}
catch
{
Lb3SumF.Text = "";
}
}