Answered by:
Totaal
Question

Hi
how can a textbox get the total of all entered numbers in other textbox?
what I have gets the number + the entered number like:
1 entered, 2 entered, 3 entered
en the total will be 123, but what I want is "6 "witch is"= 1+2+3"
Friday, November 1, 2013 11:48 AM
Answers

Hi,
(1)Initialise string variable & store value of Entered Number of First Text Box
(2)Using Subtring function, isolate each digit
(3)Do the sum by any arithmetic function
(4)Show the sum in Second Text Box
Thanks,
Himanshu
Himanshu Mehta
 Marked as answer by Jack ZhaiMSFTMicrosoft contingent staff Monday, November 4, 2013 9:41 AM
Friday, November 1, 2013 12:40 PM
All replies

Hi,
(1)Initialise string variable & store value of Entered Number of First Text Box
(2)Using Subtring function, isolate each digit
(3)Do the sum by any arithmetic function
(4)Show the sum in Second Text Box
Thanks,
Himanshu
Himanshu Mehta
 Marked as answer by Jack ZhaiMSFTMicrosoft contingent staff Monday, November 4, 2013 9:41 AM
Friday, November 1, 2013 12:40 PM 

Try this logic. it may work.
string s1 = Editbox.Text;
int total = 0;
for (int i =0; i < s1.length ; i++)
{ total = total + Convert.ToInt32(s1[i]);
}
Console.Writeline ("Total is .. " + total);
 Proposed as answer by MuraliGollapudi Monday, November 4, 2013 12:12 PM
Saturday, November 2, 2013 5:13 PM