【发布时间】:2014-02-06 06:45:26
【问题描述】:
我的代码是:
protected void txttotal_TextChanged(object sender, EventArgs e)
{
int a = Convert.ToInt32(txtmaths.Text);
int b = Convert.ToInt32(txtsci.Text);
int c = Convert.ToInt32(txtenglish.Text);
int tot = a + b + c;
txttotal.Text = Convert.ToString(tot);
}
我正在尝试将总分添加到文本框,但它不起作用。您能帮帮我吗?
【问题讨论】:
-
“不工作”通常不是很有帮助
-
此事件绑定到哪些控件?从名字听起来好像是绑定到
txttotal(然后修改了txttotal里面的文字)...应该是绑定到3个主题输入框... -
为什么要在处理任何 TextChanged 事件的事件处理程序中设置新文本?
标签: c# .net event-handling