Click here to Skip to main content
11,479,034 members (61,802 online)
Click here to Skip to main content

Convert Number to Word

, 19 Feb 2008 CPOL 115.4K 8.4K 32
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

Patel Pranav
Software Developer (Senior)
India India
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

Comments and Discussions

 
GeneralWorked Pin
Member 1112113630-Sep-14 8:16
memberMember 1112113630-Sep-14 8:16 
GeneralTHANKS A LOT Pin
Member 1111700928-Sep-14 23:32
memberMember 1111700928-Sep-14 23:32 
Questionnumber conversion Pin
Member 1102112918-Aug-14 22:05
memberMember 1102112918-Aug-14 22:05 
Questionnumber conversion using vb.net Pin
Member 1102112918-Aug-14 21:53
memberMember 1102112918-Aug-14 21:53 
QuestionTHANKS A LOT DEAR..... Pin
satishgurav18-Jul-14 19:21
membersatishgurav18-Jul-14 19:21 
GeneralMy vote of 3 Pin
Ashoka Pathirana21-May-14 19:38
professionalAshoka Pathirana21-May-14 19:38 
Questionthanks Pin
Ram A Singh14-Aug-13 7:50
memberRam A Singh14-Aug-13 7:50 
QuestionIt never converts zeros Pin
JAYANTHIMURUGESAN26-Mar-13 15:33
memberJAYANTHIMURUGESAN26-Mar-13 15:33 
GeneralThanks Pin
taenel l pasaylo27-Jan-13 2:27
membertaenel l pasaylo27-Jan-13 2:27 
QuestionNot perfect Pin
alifaris5-Nov-12 9:36
memberalifaris5-Nov-12 9:36 
Questionproject Pin
rahul binaikia29-May-12 5:58
memberrahul binaikia29-May-12 5:58 
QuestionThanks !!! Pin
Member 340016411-May-12 16:17
memberMember 340016411-May-12 16:17 
GeneralMy vote of 5 Pin
Jack_32123-Apr-12 0:38
memberJack_32123-Apr-12 0:38 
QuestionThanks Pin
Member 850926513-Mar-12 20:09
memberMember 850926513-Mar-12 20:09 
Thanks dear you have done a great job
GeneralMy vote of 4 Pin
Md. Marufuzzaman2-Jan-12 20:22
mvpMd. Marufuzzaman2-Jan-12 20:22 
GeneralMy vote of 5 Pin
Аslam Iqbal26-Dec-11 21:43
memberАslam Iqbal26-Dec-11 21:43 
GeneralNice Work Pin
maruf2111-Dec-11 13:17
membermaruf2111-Dec-11 13:17 
GeneralMy vote of 1 Pin
Member 846869111-Dec-11 5:16
memberMember 846869111-Dec-11 5:16 
GeneralMy vote of 1 Pin
divyanivas18-Aug-11 10:10
memberdivyanivas18-Aug-11 10:10 
GeneralHow do increase to more than 999999999.99 Pin
Deepesh Krishnan29-Apr-11 20:50
memberDeepesh Krishnan29-Apr-11 20:50 
GeneralMy vote of 5 Pin
CodeDog13-Apr-11 5:58
memberCodeDog13-Apr-11 5:58 
GeneralMy vote of 1 Pin
yogeshd3918-Feb-11 2:23
memberyogeshd3918-Feb-11 2:23 
GeneralGood Article but with alot of limitations Pin
Albert Dadze17-Dec-10 7:00
memberAlbert Dadze17-Dec-10 7:00 
GeneralMy vote of 3 Pin
Ashwani2k12-Jul-10 9:14
memberAshwani2k12-Jul-10 9:14 
GeneralUsefull Work Pin
Vimal Upadhyay16-May-10 23:43
memberVimal Upadhyay16-May-10 23:43 
GeneralThanks Pin
hrivero23-Mar-10 10:35
memberhrivero23-Mar-10 10:35 
GeneralMy vote of 1 Pin
geminiousgoel26-Jan-10 6:45
membergeminiousgoel26-Jan-10 6:45 
GeneralC# Code please Pin
yeswanths4-May-09 5:36
memberyeswanths4-May-09 5:36 
GeneralRe: C# Code please - Working upto 999999999.99 Pin
Member 468636426-Nov-09 1:09
memberMember 468636426-Nov-09 1:09 
GeneralThanks a lot Pin
rajakar0123-Dec-08 20:00
memberrajakar0123-Dec-08 20:00 
GeneralTry One million and above Pin
sensei41200131-Aug-08 23:20
membersensei41200131-Aug-08 23:20 
GeneralThanks Pin
csiconnect12-Aug-08 4:06
membercsiconnect12-Aug-08 4:06 
GeneralThanks Pin
Rai Shahid16-Jul-08 0:38
memberRai Shahid16-Jul-08 0:38 
GeneralIndRs. converter Pin
Arijit Manna15-Jul-08 3:31
memberArijit Manna15-Jul-08 3:31 

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.

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