0

Hi. I'm having a problem getting the per values or per digits entered in a textbox? and I need to sum it up that shows the answer in another textbox. like for example I've enter 123 in textbox1 and textbox2 should display the answer as 6 which the sum when you add 1+2+3.
Thanks in advance.:?:

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Momerath
0

Whatever you enter in a TextBox it is collected as a string.(Using the Text property of the TextBox)
So if you want to do your summation, you have to disect textbox1.Text with the SubString method, and transform the substring obtained to a number by using a Parse method.

1

Whatever you enter in a TextBox it is collected as a string.(Using the Text property of the TextBox)
So if you want to do your summation, you have to disect textbox1.Text with the SubString method, and transform the substring obtained to a number by using a Parse method.

If you are doing individual characters, there is no reason to use Substring (unless you like making things hard on yourself). String can be treated as character arrays, and you can use the standard array syntax to index each character.

Votes + Comments
I agree!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.