Not Yet Answered # numeric value into words vb6

choudhuryshouvi 33 soulcandra44 -2 kinwang2009 7 AndreRet 362 OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...

0

use this code

''''''''''''''''''''''PASTE THIS INTO A MODULE''''''''''''''''''''''''''''''''

Public valnum, valsent As String

Private n, intpart, realpart, numchar, intword, realword, spltval, spltword As String

Private flag As Boolean

Public Sub WordConvert()

n = ""

intpart = ""

realpart = ""

numchar = ""

intword = ""

realword = ""

spltval = ""

spltword = ""

valsent = ""

If valnum = "." Then valnum = "0.00"

If valnum = "" Then Exit Sub

intpart = Format(Int(valnum), "000000000")

realpart = Right(valnum, 2)

spltval = realpart

Call ValFind

If spltword <> "" Then realword = spltword

spltval = Mid(intpart, 1, 2)

Call ValFind

If spltword <> "" Then intword = spltword + "Crore "

spltval = Mid(intpart, 3, 2)

Call ValFind

If spltword <> "" Then intword = intword + spltword + "Lakh "

spltval = Mid(intpart, 5, 2)

Call ValFind

If spltword <> "" Then intword = intword + spltword + "Thousand "

n = Mid(intpart, 7, 1)

Call ONES

If numchar <> "" Then intword = intword + numchar + "Hundred "

spltval = Mid(intpart, 8, 2)

If intword <> "" And Val(spltval) > 0 And realword = "" Then intword = intword + "AND "

Call ValFind

If spltword <> "" Then intword = intword + spltword

If intword <> "" And realword <> "" Then valsent = intword + " AND Paise " + realword + "Only"

If intword <> "" And realword = "" Then valsent = intword + "Only"

If intword = "" And realword <> "" Then valsent = "Paise: " + realword + "Only"

End Sub

Private Sub ValFind()

n = ""

spltword = ""

If Val(spltval) = 0 Then Exit Sub

n = Left(spltval, 1)

Call TENS

spltword = numchar

If flag = False Then n = Right(spltval, 1): Call ONES: spltword = spltword + numchar

End Sub

Private Sub ONES()

numchar = ""

If n = 0 Then numchar = ""

If n = 1 Then numchar = "One "

If n = 2 Then numchar = "Two "

If n = 3 Then numchar = "Three "

If n = 4 Then numchar = "Four "

If n = 5 Then numchar = "Five "

If n = 6 Then numchar = "Six "

If n = 7 Then numchar = "Seven "

If n = 8 Then numchar = "Eight "

If n = 9 Then numchar = "Nine "

End Sub

Private Sub TENS()

numchar = ""

If n = 1 Then n = Right(spltval, 1): Call TEENS: flag = True: Exit Sub Else flag = False

If n = 0 Then numchar = ""

If n = 2 Then numchar = "Twenty "

If n = 3 Then numchar = "Thirty "

If n = 4 Then numchar = "Fourty "

If n = 5 Then numchar = "Fifty "

If n = 6 Then numchar = "Sixty "

If n = 7 Then numchar = "Seventy "

If n = 8 Then numchar = "Eighty "

If n = 9 Then numchar = "Ninety "

End Sub

Private Sub TEENS()

numchar = ""

If n = 0 Then numchar = "Ten "

If n = 1 Then numchar = "Eleven "

If n = 2 Then numchar = "Twelve "

If n = 3 Then numchar = "Thirteen "

If n = 4 Then numchar = "Fourteen "

If n = 5 Then numchar = "Fifteen "

If n = 6 Then numchar = "Sixteen "

If n = 7 Then numchar = "Seventeen "

If n = 8 Then numchar = "Eighteen "

If n = 9 Then numchar = "Nineten "

End Sub

'''''''''''''''''''''''''''''FUNCTION USAGE''''''''''''''''''''''''''''''''

Dim c as double

c=1265

valnum = Format(c, ".00")

Call WordConvert

msgbox valsent

will return 'One Thousand Two Hundred AND Sixty Five Only'

0

can u cr8 me program that words converted to numbers.(1-50) using switch. pls help me.

0

Hi locsin,

Such questions were answered many times. I hope you can go through previous solved threads.

Thanks

0

Raising the dead brrrr! I thought necromancing was only in movies and games....

Soulcandra, please start your own thread and we will gladly help. Also show us what you have done as far as coding is concerned so we can help you from there.

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

I don’t want at this stage work on a big separate project as I've already got plenty ...

Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.

btn_addline :

`Private Sub btn_addline_Click(ByVal ...`