Home All Groups Group Topic Archive Search About

Desktop Application Culture Setting

Author
16 Aug 2006 2:56 PM
Lucky
hi guys!
i've got one interesting problem.

one of my utility is generating data machine specific, i mean the data
is generated in the culture that the machine has.
my problem is with the numerical data, especially with double values.
the numeric data fetched from the database and saved on the machine is
in non english culture.
i want data in only english culture but i dont know how to set it.

The application is Windows Desktop Application.

can anyone tell me how can i set culture for my application so that it
can always you english culture(US or UK) for Datetime and numeric data?

Tools
c#.net 2005 (VS.NET 2.0)
ms sql server 2000

thanks,
Lucky

Author
16 Aug 2006 3:52 PM
Cor Ligthert [MVP]
Lucky,

> can anyone tell me how can i set culture for my application so that it
> can always you English culture(US or UK) for Datetime and numeric data?
>
This is a little bit difficult.

There is an US culture for English and there are the cultures for other
countries including the UK where English is spoken.

They both use the dot as decimal separator, but have an other date notation,

The InvariantCulture is special made for that, but that you cannot set as
culture. You can only use it in the datetimeparse and probably some other
classes.

Does not give much help, but if you want to make your program Country
depended (the US culture is not used in Canada by instance) than you have to
choice for one.

Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
Thread.CurrentThread.CurrentUICulture = New CultureInfo("en-US")

I hope this helps anyway

Cor

Show quoteHide quote
> can anyone tell me how can i set culture for my application so that it
> can always you english culture(US or UK) for Datetime and numeric data?
>
> Tools
> c#.net 2005 (VS.NET 2.0)
> ms sql server 2000
>
> thanks,
> Lucky
>
Author
17 Aug 2006 12:12 PM
Lucky
Hi Cor,
I do understand that making an application Culture specific is not a
good idea but requirement is in such a way that i have to standerdize
some of the part in specific manner so that when the data comes for
processing application finds it required formate.

by the way, that was great help for me. i was just looking for that
exact line of code.

thanks,
Lucky

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Lucky,
>
> > can anyone tell me how can i set culture for my application so that it
> > can always you English culture(US or UK) for Datetime and numeric data?
> >
> This is a little bit difficult.
>
> There is an US culture for English and there are the cultures for other
> countries including the UK where English is spoken.
>
> They both use the dot as decimal separator, but have an other date notation,
>
> The InvariantCulture is special made for that, but that you cannot set as
> culture. You can only use it in the datetimeparse and probably some other
> classes.
>
> Does not give much help, but if you want to make your program Country
> depended (the US culture is not used in Canada by instance) than you have to
> choice for one.
>
> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> Thread.CurrentThread.CurrentUICulture = New CultureInfo("en-US")
>
> I hope this helps anyway
>
> Cor
>
> > can anyone tell me how can i set culture for my application so that it
> > can always you english culture(US or UK) for Datetime and numeric data?
> >
> > Tools
> > c#.net 2005 (VS.NET 2.0)
> > ms sql server 2000
> >
> > thanks,
> > Lucky
> >