jnsimex

asked on

# sum values in a textbox C#

C# Visual Studio 2005

I have a textbox that a person enters the packaging details in i.e. 1 x 500, 2 x 50

I need to sum the total of the text entered into the textbox, which in this case would be 600.

how should I approach this problem?

I have a textbox that a person enters the packaging details in i.e. 1 x 500, 2 x 50

I need to sum the total of the text entered into the textbox, which in this case would be 600.

how should I approach this problem?

is comma delimited like you show in your question or is that to denote two textboxes?

also will you need to parse the math statement 1x500 or is there a quantity box that you multiply against another number

ASKER

hi pdavis, it is comma delimited.

As for your second question, i will need to parse 1x500 = 500 and then add it to the second math statement 2x50 = 100 for a total sum of 600.

As for your second question, i will need to parse 1x500 = 500 and then add it to the second math statement 2x50 = 100 for a total sum of 600.

will there be more than one operation per comma?

like

1 + 5 x 500, 2 x 50

or

1 x 500 x 2, 3 x 10

etc...

like

1 + 5 x 500, 2 x 50

or

1 x 500 x 2, 3 x 10

etc...

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER

Only one operation per comma

Thanks for providing the code snippet. I will test later on today and let you know the results.

Thanks for providing the code snippet. I will test later on today and let you know the results.

SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER

Thank you both for the coding.

They both worked equally well.

They both worked equally well.