Click here to Skip to main content
12,954,856 members (74,994 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a paypal element on my website and am really struggling with.

This part I am trying to draw a total for the datatable which is formatted to display in currency.

The error is a Format Exception "Input string was not in a correct format."

my code is

PaymentDetailsType pdt = new PaymentDetailsType()
OrderDescription = "Payment Details Sushant",
OrderTotal = new BasicAmountType()
currencyID = CurrencyCodeType.GBP,
Value = BasicAmountType(double.Parse(lblgTotal.Text))

I suspect it is the "Value" it is required to be a BasicAmountType.
How can I change the format to "String.BasicAmountType.Value"
Posted 4-Feb-13 23:30pm
Updated 4-Feb-13 23:54pm
Ankur\m/ 5-Feb-13 7:42am
Please use 'Have a Question or Comment' link below an answer to discuss with the answerer. Adding an answer doesn't notify him and thus he may not know about your comment.
I have moved your comment to the correct place.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Don't convert your value to Double. Try this

Value = BasicAmountType(lblgTotal.Text)
Ankur\m/ 5-Feb-13 7:39am
[moved from answer]
That doesn't work. "Input string was not in a correct format. "

The £ sign needs to be removed from the label text.
Member 9599975 5-Feb-13 9:32am
That didn't work. "Input string was not in a correct format. "

The £ sign needs to be removed from the label text.

I found a solution to that problem create another label without the currency but made it not visible and referenced that label instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,539
CHill60 3,490
Maciej Los 3,153
ppolymorphe 2,030
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 5 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100