double dblGrandTotalDue= lblSalesPrice +lblSalesTax+ lblDelivery.ToString(N2)

Expert in C # I need to know have I set this up correctly, the last part of the syntax had a red line.
Gwendolyn BernardAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
That could be:

double dblGrandTotalDue = lblSalesPrice + lblSalesTax + Convert.ToDouble(lblDelivery.ToString("N2"));

Open in new window


But, seriously, use Currency when dealing with amounts.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shaun VermaakTechnical SpecialistCommented:
double dblGrandTotalDue = lblSalesPrice.Text + lblSalesTax.Text + Convert.ToDouble(lblDelivery.ToString("N2"));

Open in new window

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
when you do arithmetic calculation, make sure the parameters/values are in numeric

for examples:
lblSalesPrice would returned as an Object (assuming lblSalesPrice is a Label control)
lblSalesPrice.Text would returned as a String

you need to do conversion to numeric for each of the parameters
Gustav BrockCIOCommented:
Though no feedback, the correct answer is probably the combination of all the suggestions.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.