1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Integer, ByVal LCTYPE As Integer, ByVal lpLCData As String, ByVal cchData As Integer) As Integer
Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Integer, ByVal LCTYPE As Integer, ByVal lpLCData As String) As Integer
Private Declare Function GetUserDefaultLCID Lib "kernel32" () As Integer
'Déclaration de la constante séparateur décimal
Private Const LOCALE_SDECIMAL = &HE
Public Property DecimalSeparator() As String
Get
Dim nLength As Integer
Dim nLocale As Integer
nLocale = GetUserDefaultLCID()
nLength = GetLocaleInfo(nLocale, LOCALE_SDECIMAL, vbNullString, 0) - 1
DecimalSeparator = Space$(nLength)
GetLocaleInfo(nLocale, LOCALE_SDECIMAL, DecimalSeparator, nLength)
End Get
Set(ByVal value As String)
Dim nLocale As Integer
If value <> DecimalSeparator Then
If value = "." Or value = "," Then
nLocale = GetUserDefaultLCID()
SetLocaleInfo(nLocale, LOCALE_SDECIMAL, value)
End If
End If
End Set
End Property |
Partager