问题
I have many Textboxes
and I want to Add the Values(Sum of Integers) of Textboxes
and Show it in a textblock
on Lost Focus Property
....
For example:
I fill a Textbox
with integer 5
, the value of Textblock
Changes to 5.... And after that I fill another Textbox
with 4... Textblock
changes to 9.
I short How can I bind single TextBlock to Multiple Textboxes with Lost_Focus Property?
Please Answer I cannot find it anywhere on Web.
回答1:
My Dear, In this way you can easily add textboxes in textblock keep
int sum=0;
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
sum = sum + Convert.ToInt32(_1.Text);
Add.Text = sum.ToString();
}
private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
sum = sum + Convert.ToInt32(_2.Text);
Add.Text = sum.ToString();
}
来源:https://stackoverflow.com/questions/28884542/how-to-do-addition-of-textbox-valuesintegers-on-lost-focus-property-and-show-i