Click here to Skip to main content
Licence CPOL
First Posted 19 Feb 2008
Views 73,881
Downloads 3,995
Bookmarked 25 times

Convert Number to Word

By | 19 Feb 2008 | Article
Convert any decimal number to word using vb.net

Introduction

I have created this function for converting amount in Indian Rupees (INR). You can manipulate as you wish like decimal setting, Doller (any currency) Prefix.

Background

I have coded this function as per client's requirement to print word format of Billed Amount.

Using the code

This two dimensional array store the primary word convertion of number.

     Function retWord(ByVal Num As Decimal) As String
        'This two dimensional array store the primary word convertion of number.
        retWord = ""
        Dim ArrWordList(,) As Object = {{0, ""}, {1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, _
                                        {5, "Five"}, {6, "Six"}, {7, "Seven"}, {8, "Eight"}, {9, "Nine"}, _
                                        {10, "Ten"}, {11, "Eleven"}, {12, "Twelve"}, {13, "Thirteen"}, {14, "Fourteen"}, _
                                        {15, "Fifteen"}, {16, "Sixteen"}, {17, "Seventeen"}, {18, "Eighteen"}, {19, "Nineteen"}, _
                                        {20, "Twenty"}, {30, "Thirty"}, {40, "Forty"}, {50, "Fifty"}, {60, "Sixty"}, _
                                        {70, "Seventy"}, {80, "Eighty"}, {90, "Ninety"}, {100, "Hundred"}, {1000, "Thousand"}, _
                                        {100000, "Lakh"}, {10000000, "Crore"}}

        Dim i As Integer
        For i = 0 To UBound(ArrWordList)
            If Num = ArrWordList(i, 0) Then
                retWord = ArrWordList(i, 1)
                Exit For
            End If
        Next
        Return retWord
    End Function
        

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Patel Pranav

Software Developer (Senior)

India India

Member

Pranav Patel
B.Sc, MCSD
 
I am serving my company as Sr. Software Engineer. I have more than 4 years of experience in Microsoft Technologies specially VB 6, VB.Net,C#,ASP.Net and MS SQL Server

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionThanks !!! PinmemberMember 340016415:17 11 May '12  
GeneralMy vote of 5 PinmemberJack_32123:38 22 Apr '12  
QuestionThanks PinmemberMember 850926519:09 13 Mar '12  
GeneralMy vote of 4 PinmvpMd. Marufuzzaman19:22 2 Jan '12  
GeneralMy vote of 5 PinmemberАslam Iqbal20:43 26 Dec '11  
GeneralNice Work Pinmembermaruf2112:17 11 Dec '11  
GeneralMy vote of 1 PinmemberMember 84686914:16 11 Dec '11  
GeneralMy vote of 1 Pinmemberdivyanivas9:10 18 Aug '11  
GeneralHow do increase to more than 999999999.99 PinmemberDeepesh Krishnan19:50 29 Apr '11  
GeneralMy vote of 5 PinmemberCodeDog4:58 13 Apr '11  
GeneralMy vote of 1 Pinmemberyogeshd391:23 18 Feb '11  
GeneralGood Article but with alot of limitations PinmemberAlbert Dadze6:00 17 Dec '10  
GeneralMy vote of 3 PinmemberAshwani2k8:14 12 Jul '10  
GeneralUsefull Work PinmemberVimal Upadhyay22:43 16 May '10  
GeneralThanks Pinmemberhrivero9:35 23 Mar '10  
GeneralMy vote of 1 Pinmembergeminiousgoel5:45 26 Jan '10  
GeneralC# Code please Pinmemberyeswanths4:36 4 May '09  
GeneralRe: C# Code please - Working upto 999999999.99 PinmemberMember 46863640:09 26 Nov '09  
GeneralThanks a lot Pinmemberrajakar0119:00 23 Dec '08  
GeneralTry One million and above Pinmembersensei41200122:20 31 Aug '08  
GeneralThanx a lot PinmemberAmit Code Project2:24 19 Aug '08  
GeneralThanks Pinmembercsiconnect3:06 12 Aug '08  
GeneralThanks PinmemberRai Shahid23:38 15 Jul '08  
GeneralIndRs. converter PinmemberArijit Manna2:31 15 Jul '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 20 Feb 2008
Article Copyright 2008 by Patel Pranav
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid