well, here is the code for converting amount nto words in VB>
' Convert a number between 0 and 999 into words.
Private Function GroupToWords(ByVal num As Integer) As _
String
Static one_to_nineteen() As String = {"zero", "one", _
"two", "three", "four", "five", "six", "seven", _
"eight", "nine", "ten", "eleven", "twelve", _
"thirteen", "fourteen", "fifteen", "sixteen", _
"seventeen", "eightteen", "nineteen"}
Static multiples_of_ten() As String = {"twenty", _
"thirty", "forty", "fifty", "sixty", "seventy", _
"eighty", "ninety"}
' If the number is 0, return an empty string.
If num = 0 Then Return ""
' Handle the hundreds digit.
Dim digit As Integer
Dim result As String = ""
If num > 99 Then
digit = num \ 100
num = num Mod 100
result = one_to_nineteen(digit) & " hundred"
End If
' If num = 0, we have hundreds only.
If num = 0 Then Return result.Trim()
' See if the rest is less than 20.
If num < 20 Then
' Look up the correct name.
result &= " " & one_to_nineteen(num)
Else
' Handle the tens digit.
digit = num \ 10
num = num Mod 10
result &= " " & multiples_of_ten(digit - 2)
' Handle the final digit.
If num > 0 Then
result &= " " & one_to_nineteen(num)
End If
End If
Return result.Trim()
End Function
Function NumberToString takes a number as a string input and returns a string representation of the number. It takes the input as a string to allow really huge numbers. The Decimal and Double data types cannot store truly enormous numbers without precision errors.
First the function checks its use_us_group_names parameter and initializes its groups array to a list of group names that is either appropriate for US/scientific use or for non-US use.
Next the function cleans up its input string a bit. It removes "$", "," and leading zeros. If the string contains a decimal point, it removes anything after it.
The code then determines how many groups of three digits the number needs. It pads the string on the left so its length is a multiple of 3.
Now the code steps through the number's three-digit groups. For each group, it extracts the digits, converts them into a number, uses function GroupToWords to convert the group into a string, and adds the group's name to the result.
Source Site could give you more information :
http://www.vb-helper.co m/ howto _net_number_to_words2.html
Answered by
Romi
, an ibibo Master,
at
3:51 PM on July 03, 2008