求大侠帮我看看代码,我想实现“总计”功能的,老是做不出来,是我想法有错还是什么。
private void button1_Click(object sender, EventArgs e){
int s, b,w,f,c;
string d;
s = int.Parse(textBox1.Text);
b = int.Parse(textBox2.Text);
w = s * b;
d = "单价:" + s +"\t"+ "数量:" + b +"\t"+ "合计:" + w;
listBox1.Items.Add(d);
for (int i = 0; i < listBox1.Items.Count;i++ )
{
c = w;
label4.Text = c.ToString();
}
}