Decimal to String

Posted on 2011-10-07
Last Modified: 2012-05-12
HI There,

I am trying to convert a value of type Decimal into String without loosing any value after the decimal point.

i.e: Private amount as Decimal = 265.10

If I use cStr(amount), the value is becoming 265.1

How to keep data (265.10)?

Question by:theartha
    LVL 69

    Accepted Solution

    have you tried:
    dim x as string
    x = amount.tostring("#,##0.00")
    LVL 69

    Expert Comment

    by:Éric Moreau
    The reason is that a Decimal value (like any other numeric type) does not keep in memory worth less 0-value.

    Author Comment


    I tried ToString("N2", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))
     but if the amount is more, its getting formatted.

    It should be 265265.10 not 265,265.10


    Author Comment

    I used ToString(###0.00), it works. Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now