Link to home
Start Free TrialLog in
Avatar of Chuckbuchan
Chuckbuchan

asked on

converting numbers(currency) to strings in VB

I would like to know about a predifined function, or a sort of algorithm, that converts the numbers (Currency) to strings.
example when I calculate an amout of a bill if it rings $200.57 , it should say Two Hundred Dollars and Fifty Seven Cents.
Thanks you,
Avatar of bkthompson2112
bkthompson2112

Hi Chuckbuchan,

See this link:  http://www.vb-helper.com/howto_number_to_words.html

bkt
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The answers above might be good.I think those are not sophisticated at all...let me tell you my idea.
The easiest way is to read the number from left, every 3 main digits (e.g.  123 million 456 thousand 456) till you reach the decimal. Then you print " Dollars " and read the 2 numbers after the decimal...
To be well organized, I'd used 4 or 5 methods. One of them receives a single digit to read, method2 receives 2 digits to read and obviously they return a string. You would call the methods recursively.
So you put this in method 1 with a 'select case' which is easier than 'if' statements.
"One"
"Two"
"Three"
"Four"
"Five"
"Six"
"Seven"
"Eight"
"Nine"
and this in method 2:
select case
"Ten"
"Eleven"
"Twelve"
"Thirteen"
"Fourteen"
"Fifteen"
"Sixteen"
"Seventeen"
"Eighteen"
 "Nineteen"