All,

I have a form that currently displays an integer value in a label to a user
but want it to now display the text equivalent. For example, if I have 54,
it should say fifty four. Any class examples on doing this or should I just
do it with a case function? Not to be picky, but....Ideas in VB would be
best.

Thanks,
Brian

Re: Integer Number -> Text Number by Jesse

Jesse
Thu Jul 26 16:31:46 CDT 2007

* news.microsoft.com wrote, On 26-7-2007 21:25:
> All,
>
> I have a form that currently displays an integer value in a label to a user
> but want it to now display the text equivalent. For example, if I have 54,
> it should say fifty four. Any class examples on doing this or should I just
> do it with a case function? Not to be picky, but....Ideas in VB would be
> best.

I don't think there is something like this in the base class library.
You might be lucky in the Speech SDK though. In order to pronounce a
number, it must be parsed correctly. But it's a long shot.

A case statement might work for most numbers, but would need quite a few
exceptions I guess. At least in different languages than English. (Frech
comes to mind, Dutch also has quite a few specifics).

Jesse

Re: Integer Number -> Text Number by Morten

Morten
Fri Jul 27 02:25:12 CDT 2007

On Thu, 26 Jul 2007 21:25:20 +0200, news.microsoft.com <BrianHammer@community.nospam> wrote:

> All,
>
> I have a form that currently displays an integer value in a label to a user
> but want it to now display the text equivalent. For example, if I have 54,
> it should say fifty four. Any class examples on doing this or should I just
> do it with a case function? Not to be picky, but....Ideas in VB would be
> best.
>
> Thanks,
> Brian
>
>
>

Hi Brian,

There are no premade classes that will do this for you, which means you need to custom make it yourself (or use a third party component). In any case, this will probably break any globalization of your application. If you only need English translation this won't be a problem.

The articles below demonstrates the principles of such a translation.

http://www.blackwasp.co.uk/NumberToWords.aspx
http://www.vb-helper.com/howto_number_to_words.html

--
Happy coding!
Morten Wennevik [C# MVP]