Visual Basic Code of the Week (COTW)
http://www.codeoftheweek.com
Issue #22
All content and source code is Copyright (c) 1998 by C&D Programming Corp. None of the source can be reprinted in any manner without express written permission of C&D Programming Corp.

Our Sponsor for this Issue

MCG, Inc is a small consulting company located in the New York area that specializes in Visual Basic programming. We have been in the programming field for over 10 years. We are currently looking for an experienced Visual Basic programmer to work in the New York/New Jersey/Long Island area. You should have at least 3 years of Visual Basic experience and have some experience working in a team environment. Requirements include Visual Basic 4.0/5.0, Microsoft Access and Oracle is a plus. The salary is very competitive and includes full health coverage and retirement plan.

If this type of position sounds interesting to you, please email us at mcg@codeoftheweek.com

If you are interested in advertising in COTW (our rates are VERY reasonable), please email us at sponsor@codeoftheweek.com


Requirements for this Issue

The source code in this issue is designed for Visual Basic 3.0 and higher.

In this Issue

This issue introduces a module which converts a number into its English equivalent. This code was originally intended to aid in printing and displaying checks. For example, it will take the number 23501.50 and convert it to "Twenty Three Thousand Five Hundred One Dollars and Fifty Cents"

It supports numbers as large as 999,999,999,999.99. The problem with the english for a number this long is that it probably won't fit on a check anyway. Besides, how many of you have received a check recently for anything over several thousand dollars. I would imagine the largest businesses don't even write a check for a billion dollars.

NumToWords

Public Function NumToWords(ByVal dNum As Double) As String

Parameters

Returns

This function returns a string that contains the English equivalent of the number passed in dNum.

Sample Usage

Below are two examples of how this function works.

    x = 23501.50
    MsgBox NumToWords(x)
    x = 1001.00
    MsgBox NumToWords(x)

The first message box will say: "Twenty Three Thousand Five Hundred One Dollars and Fifty Cents" and the second will say "One Thousand One Dollars and Zero Cents"


Source Code

To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0022.html


This document is available on the web

Paid subscribers can view this issue in HTML format. There is no additional source or information in the HTML formatted document. It just looks a little better. Just point your browser to http://www.codeoftheweek.com/membersonly/bi/0022.html

Summary

That concludes this issue of COTW. We hope you find the source code useful in your development.

The below describes the ways you can supply us some feedback about COTW. We would like to see our members help mold COTW into the best Visual Basic source code resource available. But to do that we need your feedback about what you like and what you do not like about COTW.

Future Issues

We are currently planning for the next several issues of Code of the Week. If you have any suggestions of source code that you would like to see covered, please jump

How to tell us what you think

If you have any suggestions for topics you would like to see covered or questions about this issue, please email them to info@codeoftheweek.com or use online feedback form at http://www.codeoftheweek.com/feedback.html.

If you have any source code you would like to submit for possible inclusion in COTW, please fill out our online submission form at http://www.codeoftheweek.com/submission.html.

Contact Information

C&D Programming Corp.
PO Box 20128
Floral Park, NY 11002-0128
Phone or Fax: (212) 504-7945
Email: info@codeoftheweek.com
Web: http://www.codeoftheweek.com

Subscription Update

Thank you for trying Code of the Week for Visual Basic.

Your free trial expires after you receive your fourth issue. If you want to continue to receive Code of the Week you can get 52 issues of COTW for only $19.95. This is a full year of Visual Basic source code and information to help with all your development. So don't wait, subscribe now! The quickest way to subscribe is to jump to our online order form at http://www.codeoftheweek.com/order.html