In visual basic (not in .Net) how can I represent numbers in Indian currency format.
For e.g., 12,34,56,789.00 inspite of 123,456,789.00
Printable View
In visual basic (not in .Net) how can I represent numbers in Indian currency format.
For e.g., 12,34,56,789.00 inspite of 123,456,789.00
Thread moved from the FAQ forum, which is not the place to post your questions.
http://www.vbforums.com/attachment.p...id=47243&stc=1
MyFormattedValue = Format$(MyOldValue, "0.00")
Click link in sig
Below is my single-line function. It works on any number in Currency range with or without fraction, negative or positive.
Code:Function FormatINR(ByVal Amount As Currency, _
Optional ByVal DigitsAfterDot As Byte = 2) As String
'-- Convert Amount to Indian Currency format: ##,##,##,##,##,##,##0.00
FormatINR = Format(Amount, Replace(Space((Len(Str(Fix(Amount))) - 3) \ 2), " ", "##\,") _
& "##0" & String(-(DigitsAfterDot > 0), ".") & String(DigitsAfterDot, "0"))
End Function
12,34,56,78,90,12,345.67Code:Sub Test()
Debug.Print FormatINR(123456789012345.67@)
Debug.Print FormatINR(123456.78@, 0)
Debug.Print FormatINR(-123456.78@)
End Sub
1,23,457
-1,23,456.78