by Krishan Kumar Sharma (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 10th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Convert Any Number Upto 999999999 Into Character Value i.e. Convert 420786 into Four Lakh Twenty Thousand Seven Hundred Eighty Six
API Declarations
' Just Do The Following
''''''At The Page Number 15 Of This Site The Address Mention As Above
''''''http://vbcode.com/asp/code.asp?lstCategory=String+Handling/Manipulation
''''''DownLoad The Resource String From Krishan Kumar Sharma's Convert 999999999 Into Character String
''''''& Enjoy The kishan's Convert Function
''''''Bye
''''''& Have A Nice Day
'*|*'dim amtwords as string
'*|*'amtwords=convert(val(text1.text))
'*|*'Simple ;-)
''''''If U Like This Function Then
''''''Drop A Mail To Me
''''''For Any Kind Of Visual Basic Help & Other Stuff
''''''At [email protected]
''''''& [email protected]
''''''At The Page Number 15 Of This Site The Address Mention As Above
''''''http://vbcode.com/asp/code.asp?lstCategory=String+Handling/Manipulation
''''''DownLoad The Resource String From Krishan Kumar Sharma's Convert 999999999 Into Character String
''''''& Enjoy The kishan's Convert Function
''''''Bye
''''''& Have A Nice Day
Public Function convert(kishan As Long) As String
'''''''' Useing To Avoid The Error String
'''''''' Not Found
If kishan = "100" Then
covert = "One Hundered"
Exit Function
ElseIf kishan = "1000" Then
convert = "One Thousand"
Exit Function
ElseIf kishan = "10000" Then
convert = "Ten Thousand"
Exit Function
ElseIf kishan = "100000" Then
convert = "One Lakh"
Exit Function
ElseIf kishan = "1000000" Then
convert = "Ten Lakh"
Exit Function
End If
'''''' Processing Start From Here
alen = Len(Trim(Str(kishan)))
'''''' Below Hundred
If alen = 2 Or alen = 1 Then
main11 = kishan '10
If main11 = "00" Or main11 = "0" Then
Else
res = LoadResString(main11)
End If
convert = res
End If
'''''One Hundered Completed
If alen = 3 Then
main11 = Left(kishan, 1) '100
If main11 = "00" Or main11 = "0" Then
Else
res = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) '10
If main11 = "00" Or main11 = "0" Then
Else
res1 = LoadResString(main11)
End If
convert = res & res1
End If
'''' One Thousand Completed
If alen = 4 Then
main11 = Left(kishan, 1) ' 1000
If main11 = "00" Or main11 = "0" Then
Else
res2 = LoadResString(main11) & " Thousand "
End If
main11 = Mid(kishan, 2, 1) ' 100
If main11 = "00" Or main11 = "0" Then
Else
res3 = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) ' 10
If main11 = "00" Or main11 = "0" Then
Else
res4 = LoadResString(main11)
End If
convert = res2 & res3 & res4
End If
'''' Ten thousand Completed
If alen = 5 Then
main11 = Left(kishan, 2) '10000
If main11 = "00" Or main11 = "0" Then
Else
res2 = LoadResString(main11) & " Thousand "
End If
main11 = Mid(kishan, 3, 1) '100
If main11 = "00" Or main11 = "0" Then
Else
res3 = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) '10
If main11 = "00" Or main11 = "0" Then
Else
res4 = LoadResString(main11)
End If
convert = res2 & res3 & res4
End If
'''' One Lackh Completed
If alen = 6 Then
main11 = Left(kishan, 1) '100000
If main11 = "00" Or main11 = "0" Then
Else
res = LoadResString(main11) & " Lakh "
End If
main11 = Mid(kishan, 2, 2) ' 10000
If main11 = "00" Or main11 = "0" Then
Else
res2 = LoadResString(main11) & " Thousand "
End If
main11 = Mid(kishan, 4, 1) '100
If main11 = "00" Or main11 = "0" Then
Else
res3 = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) '10
If main11 = "00" Or main11 = "0" Then
Else
res4 = LoadResString(main11)
End If
convert = res & res2 & res3 & res4
End If
'''''' Ten Lakh Completed
If alen = 7 Then
main11 = Left(kishan, 2) '1000000
If main11 = "00" Or main11 = "0" Then
Else
res = LoadResString(main11) & " Lakh "
End If
main11 = Mid(kishan, 3, 2) ' 10000
If main11 = "00" Or main11 = "0" Then
Else
res2 = LoadResString(main11) & " Thousand "
End If
main11 = Mid(kishan, 5, 1) '100
If main11 = "00" Or main11 = "0" Then
Else
res3 = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) '10
If main11 = "00" Or main11 = "0" Then
Else
res4 = LoadResString(main11)
End If
convert = res & res2 & res3 & res4
End If
''''''' One Crore Completed
If alen = 8 Then
main11 = Left(kishan, 1) '10000000
If main11 = "00" Or main11 = "0" Then
Else
re = LoadResString(main11) & " Crore "
End If
main11 = Mid(kishan, 2, 2) '1000000
If main11 = "00" Or main11 = "0" Then
Else
res = LoadResString(main11) & " Lakh "
End If
main11 = Mid(kishan, 4, 2) ' 10000
If main11 = "00" Or main11 = "0" Then
Else
res2 = LoadResString(main11) & " Thousand "
End If
main11 = Mid(kishan, 6, 1) '100
If main11 = "00" Or main11 = "0" Then
Else
res3 = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) '10
If main11 = "00" Or main11 = "0" Then
Else
res4 = LoadResString(main11)
End If
convert = re & res & res2 & res3 & res4
End If
''''''''' Ten Crore Completed
If alen = 9 Then
main11 = Left(kishan, 2) ' 100000000
If main11 = "00" Or main11 = "0" Then
Else
re = LoadResString(main11) & " Crore "
End If
main11 = Mid(kishan, 3, 2) '1000000
If main11 = "00" Or main11 = "0" Then
Else
res = LoadResString(main11) & " Lakh "
End If
main11 = Mid(kishan, 5, 2) ' 10000
If main11 = "00" Or main11 = "0" Then
Else
res2 = LoadResString(main11) & " Thousand "
End If
main11 = Mid(kishan, 7, 1) '100
If main11 = "00" Or main11 = "0" Then
Else
res3 = LoadResString(main11) & " Hundered "
End If
main11 = Right(kishan, 2) '10
If main11 = "00" Or main11 = "0" Then
Else
res4 = LoadResString(main11)
End If
convert = re & res & res2 & res3 & res4
End If
End Function
No comments have been posted about Convert Any Number Upto 999999999 Into Character Value i.e. Convert 420786 into Four Lakh Twenty Th. Why not be the first to post a comment about Convert Any Number Upto 999999999 Into Character Value i.e. Convert 420786 into Four Lakh Twenty Th.