Register  |  Login
  Information > DNN Blog > DNN Events
DotNetNuke Blog

Current Articles | Categories | Search | Syndication

Currency bug in Events Module

A bug appeared during the week in the module, related to how some countries handle currency strings. For example in some European countries the decimal delimiter is a ','. So €5 can be represented as 5,00. The problem is PayPal doesn't accept this, in must be in the format 5.00.

So I've added some coding to process the currency in a neutral format for passing to PayPal.

Old code is:-

strPayPalURL = strPayPalURL & "&amount=" & HTTPPOSTEncode(lblFee.Text)

New code is:-

' Make sure currency is in correct format
Dim dblFee As Double = CDbl(lblFee.Text)
Dim uiculture As CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture
strPayPalURL = strPayPalURL & "&amount=" & HTTPPOSTEncode(Format(dblFee, "#,##0.00"))
System.Threading.Thread.CurrentThread.CurrentCulture = uiculture

posted @ 11 July 2008 09:49 by Roger Selwyn

Previous Page | Next Page

COMMENTS

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above: