Format Percetage

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Samuel

    #1

    Format Percetage


    Why when using the FormatPercentag e method I get a figure which is 100 times
    what in the database and what is the common approach to resolve that?

    Thanks,
    Sam


  • Patrice

    #2
    Re: Format Percetage

    This is because this formatting option assumes that 50 % means 50/100 that
    is 0.5 (and not 50 as you could thought).

    So do your own formatting (by just appending the % sign) or scale down your
    values in the 0,1 range instead of the 0,100 range...

    ---
    Patrice

    "Samuel" <samuel.shulman @ntlworld.coma écrit dans le message de news:
    e8RAECMvHHA.335 6@TK2MSFTNGP03. phx.gbl...
    >
    Why when using the FormatPercentag e method I get a figure which is 100
    times what in the database and what is the common approach to resolve
    that?
    >
    Thanks,
    Sam
    >

    Comment

    • DOsborn

      #3
      Re: Format Percetage

      On Jul 2, 10:49 am, "Samuel" <samuel.shul... @ntlworld.comwr ote:
      Why when using the FormatPercentag e method I get a figure which is 100 times
      what in the database and what is the common approach to resolve that?
      >
      Thanks,
      Sam
      FormatPercentag e is expecting a decimal (as in .50 instead of 50%) and
      multiples by 100 to get a proper percent. If you just want to format
      it try using String.Format.

      David


      Comment

      Working...