hello!

is there any body to help me.

i want to know the codes of converting number to words...

pls help me to do it.

0

is there any body to help me.

i want to know the codes of converting number to words...

pls help me to do it.

0

You need to convert 10 to "10"?

Or you want to convert 65 to "A"?

First case, use "C" functions - CStr, CInt, CLng, CBool... -, to convert any type to the type specified in function name. This `cNum = CStr(nValor)`

puts the integer value of nValor variable in the cNum string variable, in format of a string.

Second case, use CHR (to convert from number to letter) or ASC (to convert from letter to number) functions, both uses ASCII table for converting.

Please, be more specific when you ask for help; if possible, uses examples.

Sidnei

0

sidnei, I believe quick is wanting to convert 1,234.56 to One thousand two hundred thirty four and fifty six or ... four dollars and fifty six cents...

So quick, I suggest you use your friends (yahoo, google, ask, answers, bing) and search for vb6 convert number to words or if I remember correctly, search this forum for those keywords as I believe just a month or so ago someone posted the solution you are looking for...

Good Luck

-1

if you convert 10 to 'ten' then try this

No declarations at all.

1. Create a form and add two textboxes; TextBox1 and TextBox2

2. Add a command button; CommandButton1

3. Copy the code below to the code window.

4. Run the program, enter the number in TextBox1 and click CommandButton1...

```
Function Getword(strNumber)
Dim strtemp As String
Dim x, y, z As Integer
x = Val(Mid$(strNumber, 1, 1))
y = Val(Mid$(strNumber, 2, 1))
z = Val(Mid$(strNumber, 3, 1))
If Len(strNumber) = 1 Then
strtemp = strtemp + Whole(Val(strNumber))
GoTo 20
ElseIf Len(strNumber) = 2 Then
If x = 1 And y = 0 Then
strtemp = strtemp + " Ten"
ElseIf x = 1 And y = 1 Then
strtemp = strtemp + " Eleven"
GoTo 20
ElseIf x = 1 And y = 2 Then
strtemp = strtemp + " Twelve"
GoTo 20
ElseIf x = 1 And y > 2 Then
strtemp = strtemp + Whole2(y) + "een"
GoTo 20
ElseIf x = 0 And y > 0 Then
strtemp = strtemp + Whole(y)
GoTo 20
ElseIf x = 0 And y = 0 Then
strtemp = ""
GoTo 20
Else
strtemp = Whole2(x) + "y"
If y > 0 Then strtemp = strtemp + Whole(y)
GoTo 20
End If
ElseIf Len(strNumber) = 3 Then
If x > 0 Then strtemp = strtemp + Whole(x) + " Hundred"
If y = 1 And z > 2 Then
strtemp = strtemp + Whole2(z) + "een"
GoTo 20
ElseIf y = 1 And z = 1 Then
strtemp = strtemp + " Eleven"
GoTo 20
ElseIf y = 1 And z = 2 Then
strtemp = strtemp + " Twelve"
GoTo 20
ElseIf y = 1 And z = 0 Then
strtemp = strtemp + " Ten"
GoTo 20
ElseIf x = 0 And y = 0 And z = 0 Then
strtemp = ""
GoTo 20
Else
End If
If y > 0 Then strtemp = strtemp + Whole2(y) + "y"
If z > 0 Then strtemp = strtemp + Whole(z)
End If
20 Getword = strtemp
End Function
Function Whole(ByVal x As Integer)
Select Case x
Case Is = 9
Whole = " Nine"
Case 8
Whole = " Eight"
Case 7
Whole = " Seven"
Case 6
Whole = " Six"
Case 5
Whole = " Five"
Case 4
Whole = " Four"
Case 3
Whole = " Three"
Case 2
Whole = " Two"
Case 1
Whole = " One"
End Select
End Function
Function Whole2(ByVal x As Integer)
Select Case x
Case Is = 9
Whole2 = " Ninet"
Case 8
Whole2 = " Eight"
Case 7
Whole2 = " Sevent"
Case 6
Whole2 = " Sixt"
Case 5
Whole2 = " Fift"
Case 4
Whole2 = " Fourt"
Case 3
Whole2 = " Thirt"
Case 2
Whole2 = " Twent"
End Select
End Function
Private Sub CommandButton1_Click()
Dim bigstrNumber(11)
Dim strAdd As String
Dim strNumber As String
Dim strtemp As String
TextBox1 = Abs(Int(TextBox1))
strNumber = TextBox1.Text
TextBox2 = ""
bigstrNumber(0) = ""
bigstrNumber(1) = " Thousand"
bigstrNumber(2) = " Million"
bigstrNumber(3) = " Billion"
bigstrNumber(4) = " Trillion"
bigstrNumber(5) = " Quadrillion"
bigstrNumber(6) = " Pentillion"
bigstrNumber(7) = " Hexillion"
bigstrNumber(8) = " Qentillion"
bigstrNumber(9) = " Octillion"
bigstrNumber(10) = " Nonillion"
bigstrNumber(11) = " Decillion"
If Len(strNumber) > 3 Then
Do While i < 36
m = m + 1
i = i + 3
If i >= Len(strNumber) Then Exit Do
Loop
c = i - Len(strNumber)
If c > 0 Then
For D = 1 To c
strAdd = strAdd + "0"
Next D
Else
End If
strNumber = strAdd + strNumber
k = 1
For i = 1 To m
TextBox2 = TextBox2 & Getword(Mid$(strNumber, k, 3))
If Mid$(strNumber, k, 3) <> "000" Then TextBox2 = TextBox2 & bigstrNumber(m - i)
k = k + 3
Next i
Else
End If
TextBox2 = Trim$(TextBox2 & Getword(strNumber))
TextBox1 = Format$(TextBox1, "###,###,###,###,###,###,###,###,###,###,###,###")
End Sub
```

0

if you convert 10 to 'ten' then try this

No declarations at all.

1. Create a form and add two textboxes; TextBox1 and TextBox2

2. Add a command button; CommandButton1

3. Copy the code below to the code window.

4. Run the program, enter the number in TextBox1 and click CommandButton1..

What are they going to learn turning in *your* program? And don't tell me "*they use it for a pattern for their own code*" -- you know that doesn't happen much. And even so, we *help* people write their own code, we don't give handouts. Handouts they can get from Google.

After 600+ posts you should know all this.

0

What are they going to learn turning in

yourprogram? And don't tell me "they use it for a pattern for their own code" -- you know that doesn't happen much. And even so, wehelppeople write their own code, we don't give handouts. Handouts they can get from Google.After 600+ posts you should know all this.

I only try this. but I don't know................what I did for my reputation. thanks.

0

hi ive got the same problem i tried the codes u gave but when i run the prog i get no response

where exactly do i code coz i coded in command1

thanks

0

is there any body to help me.

i want to know the codes of converting number to words...

pls help me to do it.

Dibyendu Goswami ( [email]*email snipped*[/email])

I send you this link . I think your Problem will be solved*link snipped*

*Edited
by WaltP*: Do not post email addresses on forums, Keep answers on this site as per The Rules

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

Recommended Topics

Please see my post vbScript - The Basics for more details on vbScript.

Some scripts need input (other than from the command line) ...

Please see my post vbScript - The Basics for more details on vbScript.

vbScript has a number of functions for converting from one ...

Hi there!

I am creating a toggle in pure css without jquery or javascript and its look like it hasnâ€™t work yet. The problem is Css div alignment. Its not ...