Results 1 to 13 of 13

Thread: [RESOLVED] How to convert 1 to "One", 2 to "Two", etc

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2009
    Posts
    50

    Resolved [RESOLVED] How to convert 1 to "One", 2 to "Two", etc

    I have an integer value that needs to be displayed in an error message. Not a big deal, but would love to have "eight" in the message and not 8. Is there a built in function to convert integer values to their string representation?

  2. #2
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: How to convert 1 to "One", 2 to "Two", etc

    It's in VB, but I am sure you can convert to VB.Net
    http://www.ozgrid.com/VBA/ValueToWords.htm

  3. #3
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: How to convert 1 to "One", 2 to "Two", etc

    No however google it and someones probably written a function for it. You could also easily write your own, depending on how high the number could be.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  4. #4
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: How to convert 1 to "One", 2 to "Two", etc

    Quote Originally Posted by BillBoeBaggins View Post
    It's in VB, but I am sure you can convert to VB.Net
    http://www.ozgrid.com/VBA/ValueToWords.htm
    VB is VB.Net. VB 6 is not.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  5. #5
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: How to convert 1 to "One", 2 to "Two", etc

    VB is VB.Net. VB 6 is not.
    Your point?

  6. #6
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: How to convert 1 to "One", 2 to "Two", etc

    You said he may have to convert it to VB.Net, I'm letting him no that no conversion is necessary because they are the same thing.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: How to convert 1 to "One", 2 to "Two", etc

    this might give you a head start if you're writing your own function.

    Currency to Words

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: How to convert 1 to "One", 2 to "Two", etc

    Quote Originally Posted by Vectris View Post
    VB is VB.Net. VB 6 is not.
    looks to me like its VBA, which isnot VB.Net

  9. #9
    Addicted Member
    Join Date
    Apr 2009
    Location
    Near Dog River (sorta)
    Posts
    160

    Re: How to convert 1 to "One", 2 to "Two", etc

    PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
    Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX


    "Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54

  10. #10
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: How to convert 1 to "One", 2 to "Two", etc

    Quote Originally Posted by JugglingReferee View Post
    that only does 1 trillion - 1

  11. #11
    Addicted Member
    Join Date
    Apr 2009
    Location
    Near Dog River (sorta)
    Posts
    160

    Re: How to convert 1 to "One", 2 to "Two", etc

    Quote Originally Posted by .paul. View Post
    that only does 1 trillion - 1
    So then we can't convert the US national debt using this class.
    PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
    Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX


    "Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54

  12. #12
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: How to convert 1 to "One", 2 to "Two", etc

    Divide the number a few Times: One Trillion, One Trillion, One Trillion.. etc heh.

  13. #13
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Cool Re: [RESOLVED] How to convert 1 to "One", 2 to "Two", etc



    I have just written such function . I think you can do yourselft.
    it is not difficult.
    you have to skill about string function and you can use select case clause for that function.
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width