Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. setup the COleCurrency format

setup the COleCurrency format

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionworkspace
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Willem B
    wrote on last edited by
    #1

    i really need this; i want to setup the Format of a COleCurrency. if the number is (for example) "189.728149" the hole number will be copied to a string wenn formatting it to a string. How can i change this, so after formating the number i will only have 2 decimals("189.73"). ofcourse it also has to go the other way: "189.7" ==> "189.70" thanks in advanced.. []D [] []D []

    R R 2 Replies Last reply
    0
    • W Willem B

      i really need this; i want to setup the Format of a COleCurrency. if the number is (for example) "189.728149" the hole number will be copied to a string wenn formatting it to a string. How can i change this, so after formating the number i will only have 2 decimals("189.73"). ofcourse it also has to go the other way: "189.7" ==> "189.70" thanks in advanced.. []D [] []D []

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      COleCurrency::Format is returning a CString. Maybe you should change the returned CString format using CString::Format so you won't have to bother finding a COleCurrency format that matches your wishes ? ~RaGE();

      1 Reply Last reply
      0
      • W Willem B

        i really need this; i want to setup the Format of a COleCurrency. if the number is (for example) "189.728149" the hole number will be copied to a string wenn formatting it to a string. How can i change this, so after formating the number i will only have 2 decimals("189.73"). ofcourse it also has to go the other way: "189.7" ==> "189.70" thanks in advanced.. []D [] []D []

        R Offline
        R Offline
        RobJones
        wrote on last edited by
        #3

        strCurrency.Format("%.2f",nNumber);

        W 1 Reply Last reply
        0
        • R RobJones

          strCurrency.Format("%.2f",nNumber);

          W Offline
          W Offline
          Willem B
          wrote on last edited by
          #4

          where do i get nNumber? i only have the COleCurrency, the only conversion that is possible is COleCurrency => CString(or do i get this wrong) []D [] []D []

          R 1 Reply Last reply
          0
          • W Willem B

            where do i get nNumber? i only have the COleCurrency, the only conversion that is possible is COleCurrency => CString(or do i get this wrong) []D [] []D []

            R Offline
            R Offline
            RobJones
            wrote on last edited by
            #5

            I haven't used COleCurrency, just COleTime.. if it only returns a string you could do a float nNumber = atof(string).. this would produce the number nNumber.. then you could format this number as i posted before.. Hope this helps.. Rob

            W 1 Reply Last reply
            0
            • R RobJones

              I haven't used COleCurrency, just COleTime.. if it only returns a string you could do a float nNumber = atof(string).. this would produce the number nNumber.. then you could format this number as i posted before.. Hope this helps.. Rob

              W Offline
              W Offline
              willempipi
              wrote on last edited by
              #6

              thnx.... i already found another solution

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups