Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
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
Updated 4-Feb-13 23:54pm
v3
Comments
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

Don't convert your value to Double. Try this

C#
Value = BasicAmountType(lblgTotal.Text)
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900