Results 1 to 9 of 9

Thread: Decimal Separator

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    21

    Decimal Separator

    Does anyone know how to change the decimal separator in vb.

    Thanks

  2. #2
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Decimal Separator

    Quote Originally Posted by guicarpi
    Does anyone know how to change the decimal separator in vb.

    Thanks
    what do you mean?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    21

    Re: Decimal Separator

    my defaut decimal separator is a comma (i'm french).
    for example : 2/4 = 0,5

    But I want to change it to a dot.
    for example : 2/4 = 0.5

    Is it possible ?

    Thanks

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Decimal Separator

    VB Code:
    1. MsgBox Replace(2 / 4, ",", ".")

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    21

    Re: Decimal Separator

    ok but is it possible to change the defaut value ?

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Decimal Separator

    Internally the decimal point isn't stored as part of the value, it's only when you display the value the decimal point is inserted into the correct position, and it will use the regional settings of your computer to determent what that is. You can change your regional settings using the control panel.

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Decimal Separator

    You would need to customize or change your regional settings, however that affects everything not just your vb program.

  8. #8
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Decimal Separator

    If you want you can change it with this
    Many programs do it, but in my apps I prefer not to do it. I get the decimal separator each 2 seconds (the user could change it while your app is open) then I just let the user use that separator when validating the entry.
    It's also possible to let him use both, and make a replace before using the numbers for calculations, but I think it's not a good idea.

  9. #9
    Addicted Member o0yuna0o's Avatar
    Join Date
    Mar 2006
    Posts
    172

    Re: Decimal Separator

    if it is a program that converts a fraction to decimal you can perform the (division) math operation

    2/4 will automatically become 0.5
    same with 1/2 will also become 0.5

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