Re: Problem reading Digit Grouping Symbol

Re: Problem reading Digit Grouping Symbol

am 27.11.2007 22:56:56 von Karl

Chris wrote:
> I tried to retrieve the digit grouping symbol in MSAccess but
> unfortunately 3;0 is retrieved instead of comma which is my symbol.
> Function retrieves decimal symbol and list separator without any
> problem.
>
> I used the code below:
>
> var_char_copied = GetLocaleInfo(LOCALE_USER_DEFAULT,
> LOCALE_SGROUPING, var_SYSTEM_DTG, Len(var_SYSTEM_DTG))
>
> If var_char_copied > 0 Then
> var_SYSTEM_DTG = Trim(Mid(var_SYSTEM_DTG, 1, var_char_copied))
> End If
>
> Declare Function GetLocaleInfo Lib "kernel32" Alias
> "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal
> lpLCData As String, ByVal cchData As Long) As Long
>
> Public Const LOCALE_SDECIMAL = &HE ' decimal separator
> Public Const LOCALE_SLIST = &HC ' list item separator
> Public Const LOCALE_SGROUPING = &H10 ' digit grouping
> Public Const LOCALE_USER_DEFAULT As Long = 0
>
> Thanks a lot in advance!

Well, one thing I see wrong is the LOCALE_USER_DEFAULT value (should be &h800).
Another is that you're asking for a list separator, not the digit grouping symbol,
but perhaps that's on purpose and you snipped the wrong code? You don't give enough
information to tell whether the other parameters are correct, or not. (For
instance, are you preallocating a big enough buffer?)

Try this -- http://vb.mvps.org/samples/Locale -- and let me know if it's getting the
wrong value on your system as well.

Thanks... Karl
--
..NET: It's About Trust!
http://vfred.mvps.org