Copy and paste into ur module to use directly on any windows form this can be used in web pages also.....
''' <summary>
''' This is the function which converts currency from figures into words
''' </summary>
''' <param name="Number"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Function Figures_To_Words(ByVal Number As String) As String
Figures_To_Words = "Rs."
Dim arrNUM As String() = Split(Number, ".", )
If Len(arrNUM(0)) = 1 Then
Figures_To_Words &= SingleDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 2 Then
Figures_To_Words &= TwoDigit(Right(arrNUM(0), 2))
ElseIf Len(arrNUM(0)) = 3 Then
Figures_To_Words &= ThreeDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 4 Then
Figures_To_Words &= FourDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 5 Then
Figures_To_Words &= FiveDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 6 Then
Figures_To_Words &= SixDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 7 Then
Figures_To_Words &= SevenDigit(arrNUM(0))
End If
Return UCase(Figures_To_Words & " Only")
End Function
Function SingleDigit(ByVal Digit As String) As String
Select Case Val(Digit)
Case 1 : SingleDigit = " One"
Case 2 : SingleDigit = " Two"
Case 3 : SingleDigit = " Three"
Case 4 : SingleDigit = " Four"
Case 5 : SingleDigit = " Five"
Case 6 : SingleDigit = " Six"
Case 7 : SingleDigit = " Seven"
Case 8 : SingleDigit = " Eight"
Case 9 : SingleDigit = " Nine"
Case Else : SingleDigit = ""
End Select
End Function
Function TwoDigit(ByVal Digit As String) As String
TwoDigit = ""
If Len(Digit) = 2 AndAlso Left(Digit, 1) = "1" Then
Select Case Digit
Case "10" : TwoDigit &= " Ten "
Case "11" : TwoDigit &= " Eleven"
Case "12" : TwoDigit &= " Twelve"
Case "13" : TwoDigit &= " Thirteen"
Case "14" : TwoDigit &= " Fourteen"
Case "15" : TwoDigit &= " Fifteen"
Case "16" : TwoDigit &= " Sixteen"
Case "17" : TwoDigit &= " Seventeen"
Case "18" : TwoDigit &= " Eighteen"
Case "19" : TwoDigit &= " Nineteen"
End Select
ElseIf Val(Digit) >= 20 Then
Select Case Left(Digit, 1)
Case "2" : TwoDigit &= " Twenty"
Case "3" : TwoDigit &= " Thirty"
Case "4" : TwoDigit &= " Forty"
Case "5" : TwoDigit &= " Fifty"
Case "6" : TwoDigit &= " Sixty"
Case "7" : TwoDigit &= " Seventy"
Case "8" : TwoDigit &= " Eighty"
Case "9" : TwoDigit &= " Ninty"
End Select
TwoDigit &= SingleDigit(Right(Digit, 1))
End If
End Function
Function ThreeDigit(ByVal Digit As String) As String
ThreeDigit = SingleDigit(Left(Digit, 1)) & " Hundreds" & TwoDigit(Right(Digit, 2))
End Function
Function FourDigit(ByVal Digit As String) As String
FourDigit = SingleDigit(Left(Digit, 1)) & " Thousands" & ThreeDigit(Right(Digit, 3))
End Function
Function FiveDigit(ByVal Digit As String) As String
FiveDigit = TwoDigit(Left(Digit, 2)) & " Thousands" & ThreeDigit(Right(Digit, 3))
End Function
Function SixDigit(ByVal Digit As String) As String
SixDigit = SingleDigit(Left(Digit, 1)) & " Lacs" & FiveDigit(Right(Digit, 5))
End Function
Function SevenDigit(ByVal Digit As String) As String
SevenDigit = TwoDigit(Left(Digit, 2)) & " Lacs" & FiveDigit(Right(Digit, 5))
End Function
''' <summary>
''' This is the function which converts currency from figures into words
''' </summary>
''' <param name="Number"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Function Figures_To_Words(ByVal Number As String) As String
Figures_To_Words = "Rs."
Dim arrNUM As String() = Split(Number, ".", )
If Len(arrNUM(0)) = 1 Then
Figures_To_Words &= SingleDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 2 Then
Figures_To_Words &= TwoDigit(Right(arrNUM(0), 2))
ElseIf Len(arrNUM(0)) = 3 Then
Figures_To_Words &= ThreeDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 4 Then
Figures_To_Words &= FourDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 5 Then
Figures_To_Words &= FiveDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 6 Then
Figures_To_Words &= SixDigit(arrNUM(0))
ElseIf Len(arrNUM(0)) = 7 Then
Figures_To_Words &= SevenDigit(arrNUM(0))
End If
Return UCase(Figures_To_Words & " Only")
End Function
Function SingleDigit(ByVal Digit As String) As String
Select Case Val(Digit)
Case 1 : SingleDigit = " One"
Case 2 : SingleDigit = " Two"
Case 3 : SingleDigit = " Three"
Case 4 : SingleDigit = " Four"
Case 5 : SingleDigit = " Five"
Case 6 : SingleDigit = " Six"
Case 7 : SingleDigit = " Seven"
Case 8 : SingleDigit = " Eight"
Case 9 : SingleDigit = " Nine"
Case Else : SingleDigit = ""
End Select
End Function
Function TwoDigit(ByVal Digit As String) As String
TwoDigit = ""
If Len(Digit) = 2 AndAlso Left(Digit, 1) = "1" Then
Select Case Digit
Case "10" : TwoDigit &= " Ten "
Case "11" : TwoDigit &= " Eleven"
Case "12" : TwoDigit &= " Twelve"
Case "13" : TwoDigit &= " Thirteen"
Case "14" : TwoDigit &= " Fourteen"
Case "15" : TwoDigit &= " Fifteen"
Case "16" : TwoDigit &= " Sixteen"
Case "17" : TwoDigit &= " Seventeen"
Case "18" : TwoDigit &= " Eighteen"
Case "19" : TwoDigit &= " Nineteen"
End Select
ElseIf Val(Digit) >= 20 Then
Select Case Left(Digit, 1)
Case "2" : TwoDigit &= " Twenty"
Case "3" : TwoDigit &= " Thirty"
Case "4" : TwoDigit &= " Forty"
Case "5" : TwoDigit &= " Fifty"
Case "6" : TwoDigit &= " Sixty"
Case "7" : TwoDigit &= " Seventy"
Case "8" : TwoDigit &= " Eighty"
Case "9" : TwoDigit &= " Ninty"
End Select
TwoDigit &= SingleDigit(Right(Digit, 1))
End If
End Function
Function ThreeDigit(ByVal Digit As String) As String
ThreeDigit = SingleDigit(Left(Digit, 1)) & " Hundreds" & TwoDigit(Right(Digit, 2))
End Function
Function FourDigit(ByVal Digit As String) As String
FourDigit = SingleDigit(Left(Digit, 1)) & " Thousands" & ThreeDigit(Right(Digit, 3))
End Function
Function FiveDigit(ByVal Digit As String) As String
FiveDigit = TwoDigit(Left(Digit, 2)) & " Thousands" & ThreeDigit(Right(Digit, 3))
End Function
Function SixDigit(ByVal Digit As String) As String
SixDigit = SingleDigit(Left(Digit, 1)) & " Lacs" & FiveDigit(Right(Digit, 5))
End Function
Function SevenDigit(ByVal Digit As String) As String
SevenDigit = TwoDigit(Left(Digit, 2)) & " Lacs" & FiveDigit(Right(Digit, 5))
End Function