Results 1 to 15 of 15

Thread: how to convert numbers to letters

  1. #1
    mounir_az is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jan 2009
    Posts
    18
    Reputation
    70

    how to convert numbers to letters

    hi.

    i want to know how to convert numbers to lettres.

    thank you in advance.

  2. #2
    Solitaire is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    New York
    Posts
    456
    Reputation
    177
    Please explain. What is the purpose of your program? What is the range of the numbers? Are the numbers single-digit or multi-digit? What kind of letter do you want to replace with each number?

  3. #3
    mounir_az is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jan 2009
    Posts
    18
    Reputation
    70
    Good morning

    program with visual BASIC 2005, and numbers these are numbers decimals.

    Thank you in advance

  4. #4
    Robert_Zenz's Avatar
    Robert_Zenz is offline VB.NET Forum Idol
    .NET Framework
    .NET 2.0
    Join Date
    Jun 2008
    Location
    Vienna, Austria
    Posts
    503
    Reputation
    354
    Hello.

    Are you looking for System.Convert.ToChar(yourNumberHere) or yourNumberHere.ToString() ?

    Bobby
    Don't give TypeCasting Errors a chance, turn ON Option Strict!

  5. #5
    mounir_az is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jan 2009
    Posts
    18
    Reputation
    70
    hi.
    its not working.
    are there fonction in crystal report to convert numbers to lettres.

  6. #6
    Solitaire is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    New York
    Posts
    456
    Reputation
    177
    Do you mean you want to convert an ASCII (or Unicode) value to a character? The following code will return the character "A":

    Dim ch As String
    Dim anum As Integer
    anum = 65
    ch = Chr(anum)

    If this is not what you want, then you need to explain exactly what you are trying to do, and include some of your code.

  7. #7
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    Lansing, MI; USA
    Posts
    4,362
    Reputation
    974
    You could try something like this
    Code:
    Dim Letters As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    Dim Letter As String = Letters(index)
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.


  8. #8
    mounir_az is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jan 2009
    Posts
    18
    Reputation
    70
    Good evening,
    I have a invoice in crystal report which posts the list of the products and the total sum of the products.

    I want to convert this total of the amounts of the product into letter for to post into crystal report.

    thank you in advance.

  9. #9
    Solitaire is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    New York
    Posts
    456
    Reputation
    177
    You mean you want to convert a number into a string? That's easy.

    Dim num As Double
    Dim snum As String
    num = 456.73
    snum = num.ToString

  10. #10
    anthony.selby is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Sep 2009
    Posts
    65
    Reputation
    65
    Are you asking for numbers to a string ... or numbers to words

    ie 10 = ten ?

  11. #11
    mounir_az is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jan 2009
    Posts
    18
    Reputation
    70
    yes for exemple 10 = ten

  12. #12
    anthony.selby is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Sep 2009
    Posts
    65
    Reputation
    65
    here is a project on planetsourcecode (its in vb6) so you will have to update it to work ...

    A Cheque (Check) Writing App - Numbers to Words by John Black

  13. #13
    mounir_az is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jan 2009
    Posts
    18
    Reputation
    70
    where is the project. the link dosen't work ?

  14. #14
    Solitaire is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    New York
    Posts
    456
    Reputation
    177
    What you want to do is spell out numbers using English words. That's what you should have explained in the first place.

    There is no such "function" in any language. You need to do the grunt work yourself and come up with a lot of code for each digit and each place value. Start by converting the number to a string and extracting each character one by one. Then write several subprocedures to translate each character to a word, depending on its place value. Then you will need to concatenate the words to a string corresponding to the full number.

    Do it little by little, starting with numbers up to 9, and then up to 99. By then, you should have the hang of it. Good luck.

  15. #15
    anthony.selby is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Sep 2009
    Posts
    65
    Reputation
    65
    The link works for me ...

Bookmarks

Posting Permissions

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