【发布时间】:2021-01-05 08:09:36
【问题描述】:
我想要我从不同的组合框中选择的不同值的总值,这些组合框显示在自己的文本框中。
private void tbWater1_TextChanged(object sender, TextChangedEventArgs e)
{
if(tbWater1 is null)
{
if (!string.IsNullOrEmpty(tbWater1.Text) && !string.IsNullOrEmpty(tbWater2.Text) && !string.IsNullOrEmpty(tbMais.Text))
tbTotaal.Text = (Convert.ToInt32(tbWater1.Text) + Convert.ToInt32(tbWater2.Text) + Convert.ToInt32(tbMais.Text)).ToString();
}
}
这是迄今为止我所拥有的一个文本框,它显示了组合框的值,但它没有在我想要其中的总和的文本框中显示总和。
有什么建议吗?
【问题讨论】:
-
if(tbWater1 is null)=>if(tbWater1 != null)