Results 1 to 7 of 7

Thread: Decimal "cut off"??

  1. #1

    Thread Starter
    Member frix199's Avatar
    Join Date
    Dec 2005
    Location
    Thessaloniki, Greece iamthebest: True
    Posts
    59

    Exclamation Decimal "cut off"??

    hey!

    i got a problem with a decimal...

    theres a decimal: 190,2375 (NOT always with theese numbers!)
    how can i make it: 190,24 ?????

    thankz!


    Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Decimal "cut off"??

    Well there is Math.Round() for rounding decimals but those are commas.... I don't think there is any built in functions for rounding off values with commas. Did you mean decimals and accidently put commas or vice versa?
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    Member frix199's Avatar
    Join Date
    Dec 2005
    Location
    Thessaloniki, Greece iamthebest: True
    Posts
    59

    Re: Decimal "cut off"??

    thanks for replying!

    the problem is that i want only 2 decimals, i mean the numbers after comma...
    *,???? to
    *,??

    round makes 14,683 15....

    thanks


    Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.

  4. #4
    Member
    Join Date
    Nov 2005
    Location
    Kent
    Posts
    40

    Re: Decimal "cut off"??

    Two decimal places:-
    label1.text = yourvariablename.tostring("#.00")
    It's only easy if you know!
    VB.NET2003/1.1
    VB2005/2.0

  5. #5

    Thread Starter
    Member frix199's Avatar
    Join Date
    Dec 2005
    Location
    Thessaloniki, Greece iamthebest: True
    Posts
    59

    Re: Decimal "cut off"??

    God bless you mrcrash!!!!

    THANKS!!!


    Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.

  6. #6
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Decimal "cut off"??

    The commas wouldn't matter correct?? Its just that the "decimal" value is represented as a comma on his computer setting, so it should still work...

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Decimal "cut off"??

    To aggregate the solutions provided so far, if you want the result to be a Decimal then use Math.Round. If you want the result to be a String then use ToString, although I'd go with "n2" as the parameter. Same result, just using a standard format string instead of a custom one.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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