Indian Rs Format simple Function for vb.net
Function IndianFormat(ByVal tempnumber As Double)
Dim tnumber As Double
Dim NegativeNo As Boolean
Dim tempno As String = ""
If tempnumber >= 0 Then
NegativeNo = False
Else
NegativeNo = True
End If
tnumber = Math.Abs(tempnumber)
Select Case Len(Format(tnumber, "#########0.00"))
Case Is <= 6
TempNo = Format(tnumber, "###0.00")
Case Is = 7
TempNo = Format(tnumber, "#\,##0.00")
Case Is = 8
TempNo = Format(tnumber, "##\,##0.00")
Case Is = 9
TempNo = Format(tnumber, "#\,##\,##0.00")
Case Is = 10
TempNo = Format(tnumber, "##\,##\,##0.00")
Case Is = 11
TempNo = Format(tnumber, "#\,##\,##\,##0.00")
Case Is = 12
TempNo = Format(tnumber, "##\,##\,##\,##0.00")
Case Is = 13
TempNo = Format(tnumber, "#\,##\,##\,##\,##0.00")
Case Is = 14
TempNo = Format(tnumber, "##\,##\,##\,##\,##0.00")
Case Is = 15
TempNo = Format(tnumber, "#\,##\,##\,##\,##\,##0.00")
Case Is = 16
TempNo = Format(tnumber, "##\,##\,##\,##\,##\,##0.00")
End Select
If NegativeNo = True Then
Return ("(" & Trim$(tempno) & ")")
Else
Return (Trim$(tempno))
End If
End Function
|