to find the sum of textbox values ,i use this code
private void textBox10_TextChanged(object sender, EventArgs e)
{
int n1, n2, n3, n4, n5,sum;
n1 = Convert.ToInt32(textBox6.Text.ToString());
n2 = Convert.ToInt32(textBox7.Text.ToString());
n3 = Convert.ToInt32(textBox8.Text.ToString());
n4 = Convert.ToInt32(textBox9.Text.ToString());
n5 = Convert.ToInt32(textBox10.Text.ToString());
sum = n1 + n2 + n3 + n4 + n5;
// sum
textBox16.Text = Convert.ToString(sum);
}

Vijay YadavRank #1,637 · 943 reputationPosted Apr 12, 2011, 11:08 PM EDT
May be one of your textbox value getting null value or any other value rather than number. Check once again by giving all the textboxes a numerci value. It will work!! :)
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 12, 2011, 11:20 PM EDT
CrishRank #1,487 · 1.1K reputationPosted Apr 13, 2011, 3:02 AM EDT
or
Pass the sum this Formate
txt16=txt11+txt12+txt13+txt14+txt15;
Suthish NairRank #92 · 22.8K reputationPosted Apr 14, 2011, 10:43 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 14, 2011, 11:07 PM EDT
Also, validate the data to ensure it is valid. You can use the Int32.TryParse Method instead of the Convert.ToInt32 Method to avoid errors that cause the program to fail and instead issue an error message to the user.