Wednesday, April 29, 2009

Get Number Format

'Get Number Format



Private Type NUMBERFMT

   
NumDigits As Long         
'number of decimal digits

   
LeadingZero As Long      
'if leading zero in decimal fields

   
Grouping As Long            'group size left of decimal

   
lpDecimalSep As String   
'ptr to decimal separator string

   
lpThousandSep As String  'ptr to thousand separator string

   
NegativeOrder As Long    'negative number ordering

End Type



Private Declare Function GetNumberFormat
Lib "kernel32" Alias _

"GetNumberFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, _

ByVal lpValue As String, lpFormat
As NUMBERFMT, _

ByVal lpNumberStr As String, ByVal cchNumber As Long) As Long



Private Sub Form_Load()

Dim Buffer As String, NF
As NUMBERFMT

Buffer = String(255, 0)


NF.NumDigits = 1

NF.Grouping = 2

NF.lpDecimalSep = "."

NF.lpThousandSep = ""

NF.NegativeOrder = 0



GetNumberFormat ByVal 0&, 0, "300243.24", NF, Buffer, Len(Buffer)

MsgBox Buffer

End Sub



 

No comments:

Post a Comment