Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

number format between different Regional Settings

Status
Not open for further replies.

wawanz

Programmer
Aug 29, 2002
62
ID
Hi...I built an application using the English(US) regional settings. What if a user starts the application using Indonesian regional settings...the difference is in the number format...Example: Indonesia=0,12 while US=0.12
How do I code the application, so that it would accept both settings? I'm really confused asking this question myself :)
If anyone understands my question, HELP!! There's gotta be an easy way, without changing the user's regional settings, right?
 
wawanz,

You can use the Windows API GetLocaleInfo() with constants like LOCALE_SDECIMAL (character(s) used as the decimal separator), LOCALE_STHOUSAND (character(s) used to separate groups of digits to the left of the decimal, LOCALE_SGROUPING (sizes for each group of digits to the left of the decimal) to internationalize your program and write a flexible edit control.
 
When working with numbers, you do not need to even know the local.

Any hard coded numbers in code type in US format.

Assign all numbers/results to be displayed to the user into a number variable and then display the results to the user something like:

Text1.Text = dNumber

Assign all numbers/results coming from user input, into a number variable before doing anything else with.

Do not use the Val() function on decimals, unless you only want the integer portion of the number.

When passing numbers to a SQL statement, even when they are stored in a number variable, enclose the value in single quotaion marks.

I'm sure there are a few more suggestions.

You will also need to make the same adjustments for Dates.

And then the only other real problem is the character set used.

Then change the international settings on your developing PC and test it as such.





[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top