Failed to sum splited text
- by user1784753
I have a problem when summing all of bx3.text to t2.text.
first I split bx3.text with space
private void total()
{
string[] ps = bx3.Text.Split(new string[] {" "}, StringSplitOptions.None );
t2.Text = ps.Select(x => Convert.ToInt32(x)).Sum().ToString();
}
I did try with t2.text = ps[1] and the number showed was correct.
but when i try to sum it all, I got error
"Input string was not in a correct format" on (x =
Convert.ToInt32(x))
bx3.text is full of user-input number separated by single space " "