Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

Here's a short command-line exchange:

 

>? format(10000/3, "#\,##0.00")

"3,333.33"

>? format(10000/3, "#\,##0\.00")

",33.33"

 

eh?

What happened when I escaped the dot with \. ???

 

Chris

VS2008/VB.net

Posted

Why?

 

I'm trying to globalize MS reportviewer ...the stupid thing ignores regionalsettings (so you get US dates (mm/dd/yyyy) and US numbers (1,234.56) independent of your settings)

 

Dates are now under control!

 

Numbers are more problematic - I need to handle user preferences including:

 

1'234.56

 

1'234,56

 

1,234.56

 

1.234,56

 

It is easy to format a number (10000/3) in user-preference "n", and parse out the separators - but how to force these separators into a custom formatstring?

 

Chris

  • Leaders
Posted
Can you specify a culture in the ToString and Parse methods of numeric types to parse and output (or convert) the right formatting? For example, if you need to convert to the local culture, use Decimal.TryParse (or float/double) with an invarant culture, then Decimal.ToString with the local culture?
[sIGPIC]e[/sIGPIC]
Posted

Thanks for your reply.

 

I've seen several mentions of the culture approach on the web, but this doesn't seem to be the route I'm looking for - culture is stuffed full of MS presumptions ...just because a user's setup is based on a certain culture doesn't prevent that user from having made personal modifs to regional settings.

 

I gave up: all users will now see 1'234.56 on their reports.

 

Chris

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...